Skip to the page

Node.js runtime · Concept

Is Node.js single-threaded?

The interviewer asks

People say Node.js is single-threaded. Then how does one Node process serve ten thousand open connections at the same time?

Then

Follow-ups the interviewer asks next

  1. Which parts of Node really are multi-threaded?
  2. Walk me through what happens from the moment a request's bytes arrive to the moment your handler runs.
  3. Name the event loop phases. Where do promise callbacks and process.nextTick run?
  4. So what kind of work is Node bad at, and what do you do about it?
  5. Have you seen a Node service struggle because of this? What was it?

The answer

What a strong answer covers

  • Your JavaScript runs on one main thread with one call stack. Node itself is not single-threaded: V8 has helper threads (garbage collection, compiler) and libuv has a thread pool (4 threads by default).
  • Network I/O does not use those threads. libuv asks the OS to watch thousands of sockets at once (epoll on Linux, kqueue on macOS, IOCP on Windows) and runs a callback when a socket is ready. Waiting costs almost nothing.
  • One turn of the loop: timers → pending callbacks → poll (new I/O; most request handlers start here) → check (setImmediate) → close callbacks. After each callback, Node empties the nextTick queue, then the promise microtask queue.
  • Good at I/O-bound work (APIs, proxies, real-time). Bad at long CPU work (huge JSON, image resizing, sync crypto), because while one callback runs, no other request moves.
  • For CPU work: worker threads, a separate service or queue, or more processes (cluster or more pods).

The red pen

Common traps

Avoid:"Node is multi-threaded because of libuv"; "Node can only handle one request at a time"; saying async/await moves work to another thread.

Practise this out loud

Say your answer out loud to an AI interviewer that follows up, and get a score for it.

Practise by voice

Practise questions like this out loud

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview