![为什么 `sockstat` 中显示的 `time_wait` 比实际多?](https://linux22.com/image/215730/%E4%B8%BA%E4%BB%80%E4%B9%88%20%60sockstat%60%20%E4%B8%AD%E6%98%BE%E7%A4%BA%E7%9A%84%20%60time_wait%60%20%E6%AF%94%E5%AE%9E%E9%99%85%E5%A4%9A%EF%BC%9F.png)
time_wait
为什么显示的内容/proc/net/sockstat
比实际内容多?以及如何修复它?
[root@node09 ~]# netstat -ant | grep TIME_WAIT | wc -l
28
[root@node09 ~]# netstat -ant|awk '/^tcp/ {++S[$NF]} END {for(a in S) print (a,S[a])}'
LISTEN 119
ESTABLISHED 4245
TIME_WAIT 30
[root@node09 ~]# cat /proc/net/sockstat
sockets: used 5394
TCP: inuse 4358 orphan 0 tw 7599 alloc 4391 mem 1844
UDP: inuse 1 mem 0
UDPLITE: inuse 0
RAW: inuse 0
FRAG: inuse 0 memory 0
time_wait
预期:显示的数量/proc/net/sockstat
应与实际环境相符。