Linux: RedHat as4
After the socket program closes the connection, the port is not released immediately. The default time is 60 seconds later.
Run the netstat-An command to check whether a large number of time_wait instances exist.
If the connection frequency is high, the port will be exhausted.
Solution:
# Vi/etc/sysctl. conf
Add the following content:
Net. ipv4.tcp _ tw_reuse = 1
Net. ipv4.tcp _ tw_recycle = 1
Net. ipv4.tcp _ syncookies = 1
Save and exit.
# Sysctl-P
Description
Net. ipv4.tcp _ syncookies = 1 enable the time-Wait socket reuse function, 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 reduce the time in the fin-wait-2 connection state, so that the system can process more connections.
Address: http://blog.csdn.net/Avoid/article/details/1908038