About the online environment close_wait and time_wait too high

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/Bozh/p/3752476.html

Operation and maintenance of the classmate and team inside a classmate have encountered Nginx on-line environment use will encounter time_wait or close_wait too high state

First of all, the reason why, the problem is solved.

The first is time_wait:

Understand the cause of the TIME_WAIT state, this problem has been a lot of books say rotten, but why many people still can't solve, the reason or because

Most of them are academics, and have not really encountered such problems, because a lot of time_wait are occurring in the actual application environment.

The reason for the time_wait is due to the active shutdown of the server during the communication process, and after the last fin packet is sent to the server, the system waits for double time

The MSL (Max Segment Lifetime) is used to wait for the client to send over the Fin_ack and fin, this time the service side of the corresponding socket FD is not able to re-

Use, so in a large number of short-connection services, there will be too much time_wait phenomenon.

Solution:

Adjust the time_wait time-out period

  

1 vi /etc/sysctl.conf

  

123456 net.ipv4.tcp_tw_reuse = 1 表示开启重用。允许将TIME-WAIT sockets重新用于新的TCP连接,默认为0,表示关闭;net.ipv4.tcp_tw_recycle = 1 表示开启TCP连接中TIME-WAIT sockets的快速回收,默认为0,表示关闭。net.ipv4.tcp_fin_timeout = 20

About the online environment close_wait and time_wait too high

Related Article

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.