Change Linux kernel parameters to reduce TIME-WAIT sockets in TCP connections

Source: Internet
Author: User

Modify Linux kernel parameters to reduce the TCP connection TIME-WAIT sockets tcp status: LISTEN: listening from the remote TCP port connection request SYN-SENT: Re-Send the connection request and WAIT for the matching connection request SYN-RECEIVED: after receiving and sending a connection request, WAIT for the other party to confirm the connection request. ESTABLISHED: represents an open connection www.2cto.com FIN-WAIT-1: waiting for the remote TCP connection to be interrupted, or the confirmation of the previous connection interruption request FIN-WAIT-2: from remote TCP waiting for the connection interruption request CLOSE-WAIT: waiting for the connection interruption request from the local user CLOSING: WAIT for the remote TCP to confirm the connection interruption LAST-ACK: WAIT for the original send to the remote TCP connection interruption request confirmation TIME-WAIT: wait for enough time to make sure that the remote TCP receives the confirmation of the connection interruption request CLOSED: No tcp status code ne for any connection status www.2cto.com Server Tstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print, S [a]} 'Vi/etc/sysctl. conf edit/etc/sysctl. conf file, add three lines: Reference Java code net. ipv4.tcp _ syncookies = 1 net. ipv4.tcp _ tw_reuse = 1 net. ipv4.tcp _ tw_recycle = 1 www.2cto.com Description: net. ipv4.tcp _ syncookies = 1 indicates enabling SYN Cookies. When a SYN wait queue overflows, cookies are enabled to prevent a small number of SYN attacks. The default value is 0, indicating that the service is disabled. net. ipv4.tcp _ tw_reuse = 1 indicates that reuse is enabled. Allow TIME-WAIT sockets to be re-used for a New TCP connection. The default value is 0, indicating that it is disabled. net. ipv4.tcp _ tw_recycle = 1 indicates that fast recovery of TIME-WAIT sockets in TCP connections is enabled. The default value is 0, indicating that the quick recovery is disabled. Run the following command to make the modification take effect immediately: Java code/sbin/sysctl-p

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.