event loop lag
How late the event loop is in getting round to scheduled work, a direct measure of how blocked the main thread is.
In more detail
A healthy Node.js process has lag of a few milliseconds. perf_hooks.monitorEventLoopDelay() measures it, and spikes point to synchronous work that should be moved off the main thread.
Related terms
- event loop — The central loop of an asynchronous program that waits for events, such as timers firing or data arriving, and runs the matching callbacks.
- blocking I/O — An operation that makes the program stop and wait until it finishes, so nothing else on that thread can run meanwhile.
- latency — The time between asking for something and getting the answer back.
Taught in
- Poll & Check Phases: I/O Callbacks & setImmediate — Node.js Internals & Backend Services
- Backpressure Engineering: Handling Mismatched I/O — Node.js Internals & Backend Services