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