naugtur / blocked-at

Detects node eventloop block and reports where it started
MIT License
321 stars 25 forks source link

Additional load caused by library #22

Closed riston closed 5 years ago

riston commented 5 years ago

Using this method to monitor event loop lag causes additional load to memory and CPU in my case this was about ~15%.

I started with a rather large threshold value five seconds, could that cause just filling the cache map with stack traces and now cleaning up that fast https://github.com/naugtur/blocked-at/blob/master/index.js#L4L4 ?

naugtur commented 5 years ago

The threshold shouldn't affect the performance or memory consumption. This tool stores a stack trace for each async function and removes it once the function is done. Hooks themselves are going to affect your app performance power nie initialized. That's expected.

riston commented 5 years ago

Seems like it's not the issue with library itself but more the performance hit of using async hooks(https://github.com/bmeurer/async-hooks-performance-impact)

naugtur commented 5 years ago

I'm going to document the performance impact and explicitly explain this should not be run in production by default.

naugtur commented 5 years ago

warning added