mediumScenarioConceptMidSenior
Your Node service has low CPU but latency spikes for every request at the same moment. What is happening?
Node.js event loop blocking happens when synchronous JavaScript, JSON work, crypto, regex or CPU-heavy code occupies the shared thread. The signal is every endpoint slowing together while event loop delay rises.
4 min readUpdated 2026-08-15
Answer
Short answer
Measure event loop delay first. If all requests stall together, move CPU-heavy work to worker threads or another service, chunk long loops, and replace request-path sync APIs with real asynchronous operations.
Was this answer helpful?
Likely follow-ups
- Does making the function `async` help? Why not?
- How would you measure event loop lag in production?
- When is a worker thread the right answer, and when is it overhead?
- Which built-in operations block that people assume do not?
Related questions
- Walk me through the phases of the Node event loop.mediumAlso on event-loop and performance4 min
- A read-only endpoint that returns fifty thousand rows is slow and memory-heavy in EF Core. What is the context doing?mediumAlso on performance4 min
- A Compose screen with a long list is janky while scrolling - walk through how you'd find and fix the recomposition problem causing it.mediumAlso on performance5 min
- A request fails but your Express error-handling middleware never runs. How do you work out why?mediumAlso on nodejs4 min