I'm looking for suggestions on detecting when the NodeJS event loop is blocked (due to CPU-intensive code), and determining what is causing the block.
I'm running a rather large NodeJS app. Over time, as the app and dataset have grown, things that used to process quickly have become more CPU-intensive and are blocking the event loop longer than "a few milliseconds". Tracking down the problems, and even determining how big the problem is, have proven to be more complicated than expected.
Any recommendations for the following would be much appreciated:
1. Monitor the 'health' of the NodeJS event loop, to know 'how big the problem is' – any extended blocking of the event loop is a Bad Thing, so seems a Good Practice to detect when blocking happens.
2. When the event loop is blocked, detect what is causing the block – I need a 'top' or 'ps' for the NodeJS event loop – profilers only help with this indirectly (meaning not much at all), because they don't differentiate between blocking and non-blocking activities.
Thanks for your suggestions.
Pete.