Very Large number of connections in TIME_WAIT state; Server is slow, ipconntrac

Solution 1:

Try the following:

echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse

Probably it will help to reduce the number of TIME_WAIT connections. You can also make these changes permanent in /etc/sysctl.conf:

net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_tw_recycle=1