Nginx network connection timewait Problems
Through the ss-s command, we can see that the server's timewait status is particularly large.
[Root @ tvreport231 ~] # Ss-sTotal: 103 (kernel 256) TCP: 48666 (estab 22, closed 48624, orphaned 7, synrecv 0, timewait 48623/0), ports 18
Netstat is also visible, but you need to add the-a parameter to view the time_wait status.
The following command is complex, but you can see more information:
[Root @ tvreport231 ~] # Netstat-an | awk '/tcp/{print $6}' | sort | uniq-c 11 ESTABLISHED 1 FIN_WAIT1 11 LISTEN 41300 TIME_WAIT
Solution:
One solution is to use sysctl to modify Kernel Parameters during runtime.
Add two rows at the end of the/etc/sysctl. conf file:
Net. ipv4.tcp _ tw_reuse = 1net. ipv4.tcp _ tw_recycle = 1
Then call sysctl-p to load the file. The effect is obvious.
However, it is said that this will affect Intranet users.
Sysctl reference:
Http://www.cyberciti.biz/faq/linux-kernel-etcsysctl-conf-security-hardening/
Another method is to use Nginx persistent connection.