-
Notifications
You must be signed in to change notification settings - Fork 25
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
blocked-at is unusable on express web servers - spikes CPU to 100% #36
Comments
Yes, async hooks are expensive. The more promises.oer request the worse. I think I could improve it's performance a lot tho. Care to share a minimal reproduction case? |
Sorry, I don't have any public repos I'm testing with. The configuration I tested looks similar to this:
I was seeing baseline CPU utilization increase from 3 mcores to 400 mcores. (memory remained about the same) |
Datadog might be key here. They do a great deal of monkey patching and use hooks too. Might be clashing. |
Yeah, that seems sensible. I will give that a shot. I'm seeing that many DD lines are present in our stack traces so that wouldn't surprise me.
|
My intuition is that we are probably seeing the performance issues because of this line. https://github.com/naugtur/blocked-at/blob/master/index.js#L36C1-L37C1 Where we invoke a fairly expensive function to capture and store a stack trace on every event loop cycle. (this agrees with what this article mentions) Do we know if there is a way to capture stack trace information only if the processing is too slow? (testing a fork now to see if the stack collection is the problem) |
most likely problem is async hooks. they slow things down. delete hook is the most expensive and I know I can probably get rid of it by making things clean up after themselves on report or using a weakmap. |
I did some independent testing and confirmed we are having the same performance issues as described in this post. Our CPU utilization spiked to 100% and the node fell over when I tried to use this to find blocking stack traces from a dev envionrment.
https://www.ashbyhq.com/blog/engineering/detecting-event-loop-blockers
I was running node:18.18.1-alpine in k8s with express 4.17.3
The text was updated successfully, but these errors were encountered: