This problem, you will definitely encounter after using PHP Redis. Therefore, this dish in the principle of open-minded advice, but also around the internet for advice. The answers are the following two kinds:
1, Redis does not actively close.
After the discovery, this answer is purely baseless assertion, nonsense.
2, configure the/etc/sysctl.conf, change the following configuration:
Net.ipv4.tcp_syncookies = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_fin_timeout = 20
On this plan, although more reliable, but not exactly the bull's eye. After executing the/sbin/sysctl-p, the connection to the Timewait state was found to be not improved.
After a search, finally the dish finally found the cause, the solution is configured as follows:
/etc/sysctl.conf
Net.ipv4.tcp_syncookies = 1
Net.ipv4.tcp_tw_reuse = 1
Net.ipv4.tcp_tw_recycle = 1
Net.ipv4.tcp_timestamps = 1
Net.ipv4.tcp_fin_timeout = 20
After the configuration is complete, perform/sbin/sysctl-p and run Redis again for problem resolution.
Data reference:
http://www.2cto.com/net/201503/381132.html Server TCP connection timewait too much optimization and detailed analysis
Timeout connects too many solutions after using PHP to connect to Redis