event-loopAnswer last reviewed July 2026

How do you actually measure event-loop health in production? And what thresholds are worth paging a human for?

Names the real instrumentation, monitorEventLoopDelay and eventLoopUtilization, knows what each one catches, and backs every alert threshold with reasoning

What an AI-prepared candidate might say

The standard metric is event-loop lag, which is basically how much later than scheduled the loop gets around to running its callbacks. Node exposes it through perf_hooks.monitorEventLoopDelay, which gives you a histogram of the observed delays, and most monitoring libraries like prom-client already export it as an event-loop-lag metric out of the box. A healthy service shows lag in the low milliseconds. If it's sustained above roughly 100ms, the loop is getting blocked regularly and requests are queueing. There's also event loop utilization, which reports how much of its time the loop spends active versus idle. In practice you export these to your metrics system, put them on a dashboard next to request latency, and alert when the lag stays elevated. High lag means go looking for synchronous work, large payload parsing, or garbage collection pauses in the process.

Senior
Locked

How monitorEventLoopDelay actually samples, what its histogram percentiles are telling you, and the two-snapshot ELU pattern that catches saturation the delay metric misses entirely.

Unlock the depth
Staff
Locked

The actual paging thresholds with the reasoning behind them, the alert-per-pod-never-on-averages rule, and wiring a profiler to fire on breach so spikes stop going unattributed.

Unlock the depth
Follow-up chain
How do you actually measure event-loop health in production? And what thresholds are worth paging a human for? | NodeBook