使用进程选项 (-p) 时 ss 很慢

使用进程选项 (-p) 时 ss 很慢

使用命令检查端口上侦听的进程时ss,与(过时的)命令相比,速度很慢netstat

$ time ss -nlp | grep -E ':8081|:8007|:8010'
LISTEN     0      100                      :::8081                    :::*      users:(("java",28681,47))
LISTEN     0      1          ::ffff:127.0.0.1:8007                    :::*      users:(("java",28681,220))
LISTEN     0      100                      :::8010                    :::*      users:(("java",28681,48))

real    0m0.608s
user    0m0.118s
sys 0m0.475s

$ time netstat -nlp | grep -E ':8081|:8007|:8010'
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0 :::8081                     :::*                        LISTEN      28681/java          
tcp        0      0 ::ffff:127.0.0.1:8007       :::*                        LISTEN      28681/java          
tcp        0      0 :::8010                     :::*                        LISTEN      28681/java          

real    0m0.146s
user    0m0.012s
sys 0m0.129s

为什么使用“-p”选项时“ss”速度慢?有什么替代方法可以缓解缓慢吗ss

相关内容