-
Notifications
You must be signed in to change notification settings - Fork 376
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
feat: implement monitoring of callbacks executed by process.nextTick() #277
base: master
Are you sure you want to change the base?
Conversation
This is an interesting metric! Do you have any estimate of how much overhead it adds to the running process (performance impact)? Wondering if it should be opt-in/a separate custom metric. |
I don't think this is possible when there are multiple callbacks running (which is basically always for a real production server). Callback A will delay callback B and all subsequent callbacks that were scheduled in the current event loop iteration, so it wouldn't be an accurate measurement, I think. You'd probably have to track execution time of the callback handlers more likely, which would be hard. |
I don't have numbers in my hands, but anyway I think its a good idea to make it opt-in. Will implement it today |
I separately measure execution of every callback. So execution time of callback A measured separately from callback B. |
@zbjornson I've made monitoring of process.nextTick optional, disabled by default. |
d6f2cf6
to
29b6d86
Compare
Nearly every talk about Node.js performance begins with event loop monitoring.
And one of most often recommendation is - do not run cpu intensive operations in nextTick().
So I thought it will be useful to measure how long does it takes to execute every single callback scheduled by nextTick() and how many ticks are being executed by nextTick().
To make this information actionable I also wanna implement some way to export top longest callbacks executed by nextTick() or somehow export callbacks which executes longer than some threshold. But it's not implemented yet. Any suggestions how this kind of information can be exported to prometheus are welcome :-)