netstat TCP connection under time_wait state:
1. This is a state that is in the state before the connection is completely closed;
2. You usually have to wait 4 minutes (Windows Server) for the time to shut down completely;
3. TCP connections in this state consume resources such as handles and ports, and the server consumes resources to maintain these connection states;
4. Resolving this time_wait TCP connection only allows the server to quickly reclaim and reuse those time_wait resources: Modify the registry [hkey_local_machine\system\currentcontrolset\ Services\Tcpip\Parameters] Add DWORD value tcptimedwaitdelay=30 (30 also recommended for Microsoft; default is 2 minutes) and maxuserport:65534 (optional value 5000-65534);
5. Specific TCPIP connection parameter configuration can also be referenced here: http://technet.microsoft.com/zh-tw/library/cc776295%28v=ws.10%29.aspx
6.linux under:
vi/etc/sysctl.conf
Add the following:
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_syncookies=1
To make the kernel parameters effective:
[email protected] ~]# sysctl-p
Readme:
Net.ipv4.tcp_syncookies=1 opens the time-wait socket reuse feature, which is very effective for Web servers with a large number of connections.
net.ipv4.tcp_tw_recyle=1
net.ipv4.tcp_tw_reuse=1 reduces the time that is in the Fin-wait-2 connection state, allowing the system to handle more connections.
net.ipv4.tcp_fin_timeout=30 reduces the time of TCP keepalive connection detection, allowing the system to handle more connections.
net.ipv4.tcp_keepalive_time=1800 increases the TCP SYN queue length, allowing the system to handle more concurrent connections.
net.ipv4.tcp_max_syn_backlog=8192
This article is from the "Give Me Three moles" blog, please be sure to keep this source http://wushuangjay.blog.51cto.com/3125450/1652210
timewait status in Netstat