Linux Server Optimization--time_wait problem

Source: Internet
Author: User

Linux Server Optimization --time_wait Questions:


Check for server time_wait issues:

Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, S[a]} ' return: time_wait 41735close_wait 145fin_wait2 3ESTABLISHED 413

  

Optimized configuration:

sudo nano/etc/sysctl.conf Add the following: Net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_fin_timeout = 30

  

Parameters are valid:

/sbin/sysctl-p modification Note: net.ipv4.tcp_syncookies = 1 means that Syn cookies are turned on. When a SYN wait queue overflow occurs, cookies are enabled to protect against a small number of SYN attacks, the default is 0, which means close; Net.ipv4.tcp_tw_reuse = 1 means turn on reuse. Allow time-wait sockets to be reused for new TCP connections, which defaults to 0, which means shutdown, net.ipv4.tcp_tw_recycle = 1 for fast recycling of time-wait sockets on TCP connections, and 0 for shutdown by default. Net.ipv4.tcp_fin_timeout Modify the default timeout time for the system

  

Time_wait Status Generation:
The port status of the server-side connection is time_wait after the client has established a TCP/IP connection to the server and the socket is closed
The active closed party will enter the TIME_WAIT state to stay 2MSL (max segment lifetime) time after the last ACK is sent
This is necessary for TCP/IP

Linux Server Optimization--time_wait problem

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.