这是一个创建于 2495 天前的主题,其中的信息可能已经有所发展或是发生改变。
TIME_WAIT 1979
FIN_WAIT1 3
FIN_WAIT2 24
ESTABLISHED 741
SYN_RECV 6
LAST_ACK 4
单跑 nginx,nginx 配置
worker_rlimit_nofile 200000;
worker_connections 102400;
multi_accept on;
use epoll;
keepalive_timeout 10;
client_header_timeout 10;
client_body_timeout 5;
reset_timedout_connection on;
send_timeout 10;
open_file_cache max=100000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
gzip on;
当前 sysctl.conf
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_fin_timeout = 6
net.ipv4.tcp_keepalive_probes = 3
net.ipv4.tcp_orphan_retries = 1
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 1024 65000
net.core.somaxconn =262144
net.core.netdev_max_backlog = 262144
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
找了好多资料都不见效,有没什么猛药?
3 条回复 • 2017-06-20 15:04:35 +08:00
|
|
1
ToughGuy 2017-06-20 14:23:13 +08:00 1
才 2000 个不到而已, 完全不用理会, 这个对系统性能影响甚微, 不用太想着去优化这一块儿。
下面是我们的一个 web 服务.
ss -nat | awk '{a[$1]++}END{for (i in a) printf("%-10s %s\n",a[i],i)}' | sort -rnk 1
29405 TIME-WAIT 2168 ESTAB 31 FIN-WAIT-2 15 SYN-SENT 12 LISTEN 10 SYN-RECV 3 FIN-WAIT-1 1 State 1 CLOSING
|
|
|
3
denghongcai 2017-06-20 15:04:35 +08:00 via Android 1
time_wait 是正常状态,适当限制下数量就好了 不要去搜索什么 tw 解决方法,你看你就配了个 tw_recycle 害自己
|