This page visually explains how the JavaScript / Node.js event loop handles asynchronous requests, and provides a simple calculator to estimate how many instances you might need for a given load.
โ back to all guides
Before a single line of your handler runs, the request crosses many layers.
This is the real chain for GET /user/42
hitting a Node.js API behind a load balancer. Press Trace the path.
Compute is the one main thread running your JavaScript; memory is the V8 heap holding your objects. Everything to the left of the Node process is the network and the OS โ you rarely touch it, but it is the real path every request takes. Where the arrow points down, control enters the event loop shown below.
Trace a real request โ GET /user/42
that runs a database query. Watch the call stack grow and unwind, the
query get offloaded to libuv, the callback queue and promise microtasks
fill and drain, and the event loop tick. Hover any box for its role.
GET /user/42.A back-of-the-envelope estimate of how many instances a service needs to absorb its peak traffic, leaving headroom so no single instance runs at the edge of its capacity.
This is a simplified estimate. In practice, you would validate with load testing and monitoring (CPU, memory, latency, error rates).
Check your understanding of the event loop. Pick an answer to lock it in and see the explanation. Your score updates as you go.
Press Esc or ? to close.