Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid costly process info extraction if unnecessary both on Linux and Windows #19

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

sokurenko
Copy link

We need to calculate socket count in listen state and it takes lots of resources to calculate:
time ./sbin/zabbix_agent2 -t net.tcp.socket.count[,,,,listen]
net.tcp.socket.count[,,,,listen] [s|38983]

user 0m32.999s
sys 0m0.470s

However if we modify AcceptFn always to return false and only increase counter when required then everything becomes fast:
time ./sbin/zabbix_agent2 -t net.tcp.socket.count[,,,,listen]
net.tcp.socket.count[,,,,listen] [s|38983]

user 0m0.143s
sys 0m0.296s

However it is possible to improve even further with the fix in pull request:
time ./sbin/zabbix_agent2 -t net.tcp.socket.count[,,,,listen]
net.tcp.socket.count[,,,,listen] [s|38983]

user 0m0.060s
sys 0m0.069s

And on Windows tested with 30000k sockets and it takes too long (waited for more than 30 seconds and there was still no result):
But after changes it only took 398ms

Please accept pull request, also it would be nice to document that AcceptFn can be used to calculate data without returning it as it is pretty CPU intensive, thank you!

This is required for https://support.zabbix.com/browse/ZBX-21300

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant