Turn from: http://blog.163.com/kel_scott66/blog/static/11505396320097245547700/Solve close_wait problem keywords: Linux tomcat close_wait
The recent Web server in large traffic situations often appear suspended animation phenomenon, backstage log report too many open files of the error, increase the number of Linux system file Open can solve some problems, but the same problem over time, by querying the network connection found that the TCP connection is not closed caused. As follows:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Last_ack 1
Syn_recv 15
Established 471
Fin_wait1 3
Fin_wait2 52
Syn_sent 1
Time_wait 725
To solve this problem can modify the system parameters, the system default timeout time is 7,200 seconds, that is, 2 hours.
Tcp_keepalive_time = 7200 seconds (2 hours)
Tcp_keepalive_probes = 9
TCP_KEEPALIVE_INTVL = Seconds
This means that if a TCP connection has been idle for 2 hours, the kernel will not initiate probe. If probe 9 times (75 seconds each) is unsuccessful, the kernel completely abandons and considers the connection to be invalid.
Sysctl-w net.ipv4.tcp_keepalive_time=30
Sysctl-w net.ipv4.tcp_keepalive_probes=2
Sysctl-w net.ipv4.tcp_keepalive_intvl=2
Solve close_wait problems