文章目录

在日常的服务器维护时,会出现TIME_WAITCLOSE_WAIT数量飙高的情况,检查命令为:

1
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'

Tuning 方法,编辑文件/etc/sysctl.conf如下:

1
2
3
4
5
6
7
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1800
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_keepalive_intvl = 15

修改完成后执行下面命令使之生效。

1
/sbin/sysctl -p

文章目录