Debian
编辑 sysctl.conf,单位是秒(s):
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 60
net.ipv4.tcp_keepalive_time = 600
FreeBSD
编辑 sysctl.conf,单位是毫秒(ms):
net.inet.tcp.fast_finwait2_recycle = 1
net.inet.tcp.finwait2_timeout = 60000
查看当前活跃的 TCP 连接数
$ netstat -an | grep ESTABLISHED | wc -l
使用 wrk 工具测试并发连接
$ wrk -t16 -c1000 -d60s --latency https://apple.com