Change Linux kernel parameters to reduce TIME-WAITsockets in TCP connections
Source: Internet
Author: User
Change Linux kernel parameters to reduce the TIME-WAITsocketstcp status in TCP connections: LISTEN: Listening for connection request SYN-SENT from a remote TCP port: wait for the matching connection request SYN-RECEIVED after sending the connection request again: after receiving and sending a connection request, wait for the other party to connect... 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 CLOSED of the connection interruption request: no tcp status code netstat-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
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