3 ms·
Not saying netstat isn't slow, but: # time sh -c 'netstat -tn | wc -l' 486206 real 0m13.538s user 0m1.698s sys 0m10.380s It still works with a whole lost of
by btmorex 12y ago
Not saying netstat isn't slow, but:
# time sh -c 'netstat -tn | wc -l'
486206
real 0m13.538s
user 0m1.698s
sys 0m10.380s
It still works with a whole lost of connections. (in fairness, only about 130k were connected)
- getsat 12y agoThe problem is that it doesn't scale linearly. There's some O(n4) algorithm being used in netstat or some kernel syscalls or something. Once you go over 250k, things get _really_ weird.
- patrickmcmanus 12y agotry ss -nt instead.. it uses netlink sockets instead of /proc and generally scales much better
- getsat 12y agoThanks for the tip!