r/javascript • • 6h ago

Node.js' Event Loop Delay monitor has been lying to you (for years)

https://jomi-se.com/posts/nodejs-event-loop-delay-monitor/

In Node.js, if your event loop blocks for 30 seconds with a monitor that has a 60-second window and 50 milliseconds resolution, you'll get a p99 event loop delay of 52 milliseconds. And if you're lucky, the 30-second delay might show up in the max of the event loop delay monitor.

I wrote a blog post about it. The twist at the end was a bit funny (the fix has been sitting in the codebase since 2019). It almost features no AI.

It turns out this problem was given a name more than a decade ago by Gil Tene: Coordinated Omission. Where latency in your system skews your latency measurements and makes your percentile metrics lie to you. (awesome talk by Gil Tene on youtube "How NOT to measure Latency". Can't link video or post gets autoremoved)

In simpler terms: If your measurement system has this issue, when your system stalls for 10s, your p99 metrics happily report something like 5ms. If you measure latency from inside your code, you have this issue.

1 Upvotes

Duplicates