web server tuning
更新日期:
文章目录
在日常的服务器维护时,会出现TIME_WAIT
和CLOSE_WAIT
数量飙高的情况,检查命令为:
1netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
Tuning 方法,编辑文件/etc/sysctl.conf
如下:
1234567net.ipv4.tcp_syncookies = 1net.ipv4.tcp_tw_reuse = 1net.ipv4.tcp_tw_recycle = 1net.ipv4.tcp_fin_timeout = 30net.ipv4.tcp_keepalive_time = 1800net.ipv4.tcp_keepalive_probes = 3net.ipv4.tcp_keepalive_intvl = 15
修改完成后执行下面命令使之生效。
1/sbin/sysctl -p