Too many connections in TIME_WAIT state [solved]

Are you interested for monthly server support with Unlimited tickets, 24×7 monitoring, Security Audit and lot more ? please check our Monthly server support plans

Too many connections in TIME_WAIT state:

If you seeing a lot of connections in  TIME_WAIT state then each socket in TIME_WAIT consumes some memory in the kernel, usually somewhat less than an ESTABLISHED socket. But it may increase the load in server.

For solving this you need to do the following on the server,

Login to the server via SSH

First run this command to check the status if time_wait

[email protected] [~]# netstat -nat | awk '{print $6}' | sort | uniq -c | sort -n
 1 CLOSING
 1 established)
 1 Foreign
 14 LAST_ACK
 27 CLOSE_WAIT
 31 LISTEN
 43 FIN_WAIT1
 105 FIN_WAIT2
 114 SYN_RECV
 313 ESTABLISHED
 4568 TIME_WAIT

Then enter the following command, it will append the values for timeout in the server,

echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

Also you need to edit the file,

 /etc/sysctl.conf

and add the timeout and recycle values in it.

vi /etc/sysctl.conf

And add the following values to the file

net.ipv4.tcp_fin_timeout=30
net.ipv4.tcp_tw_recycle = 1

Now it will be Ok.

Need our help to fix the issue ? Submit Support Ticket Now

View Server Administration Packages

Leave a Reply

Your email address will not be published. Required fields are marked *