Recently found that Apache and load balancer of the number of connections, and most of them are time_wait, adjust apache2.conf after the effect is not.
Resolve by adjusting kernel parameters:
Copy Code code as follows:
Edit the file and add the following:
Copy Code code as follows:
Net.ipv4.tcp_syncookies = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_fin_timeout = 30
Then, execute/sbin/sysctl-p to make the argument effective.
Net.ipv4.tcp_syncookies = 1 means to open syn cookies. When the SYN wait queue overflow occurs, cookies are enabled to handle, to prevent a small number of SYN attacks, the default is 0, indicating shutdown;
Copy Code code as follows:
Net.ipv4.tcp_tw_reuse = 1 means to turn on reuse. Allows time-wait sockets to be re used for a new TCP connection, which defaults to 0, indicating shutdown;
Net.ipv4.tcp_tw_recycle = 1 is a quick recycle of time-wait sockets on a TCP connection, and the default is 0, which means shutdown.
Net.ipv4.tcp_fin_timeout modification System Jin default timeout time
That way, you can solve the problem of too many Apache time_wait connections.