修改Linux内核参数减少squid服务器的TIME_WAIT套接字数量

编辑/etc/sysctl.conf文件,添加一下内容

net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_tw_buckets = 5000

然后执行命令 /sbin/sysctl -p
如果是Apache或者Nginx服务器则添加一下内容即可

net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_local_port_range = 10000 65000

如果是Profix邮件服务器则

net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_local_port_range = 10000 65000
kernel.shmmax = 134217728

你可能感兴趣的:(修改Linux内核参数减少squid服务器的TIME_WAIT套接字数量)