LOGBOOK

HELP

Quiz Entry - updated: 2026.07.05

What is the Node.js event loop?

The event loop lets a single Node.js thread serve many clients by pulling events off a queue and running each handler one at a time.

How it works:

  1. HTTP requests and system events enter an event queue
  2. The event loop takes events from the queue one at a time
  3. Each event is processed (handler function runs)
  4. Loop waits for next event when queue is empty

Important implications:

  • Single event queue for all clients (like browser JavaScript)
  • Keep handlers fast - slow handlers block all other requests
  • Long-running tasks should be async (database, file I/O)

Diagram:

HTTP Requests → Event Queue → Event Loop → Process Event
System Events ↗                    ↓
                              Wait for next

Tip: Never do CPU-intensive work in a request handler - it blocks the entire server.

Go deeper:

From Quiz: WEBT / Backend Development | Updated: Jul 05, 2026