When running “asadm -e collectinfo”, it takes a long time to do the connection counts using “ss”. For example, there are 3 commands like this that each take 10 minutes on our systems:
> [INFO] Data collection for [‘ss -pant | grep 3000 | grep TIME-WAIT | wc -l’] in progress…
The following takes <1s on our systems:
> ss -pant state time-wait dst :3000 | wc -l
If all you need is a count, there is no reason to use -p option. That has a drastic impact on the speed of the command. Also, please use the built in filtering for the ss command rather than passing the entire table into grep.
We have nodes with 100-150k sockets in use and the time it takes to run the current version of the command (currently 2+ hours) is excessive, especially when you can do this:
# time ss -ant state time-wait sport = :3000 or dport = :3000 | wc -l
115
real 0m0.136s
user 0m0.000s
sys 0m0.061s