Solve close_wait problems

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.