Skip to main content
Let’s answer a common interview question: a Node.js server on a single CPU core is handling 1,000 open connections at the same time — is that concurrency or parallelism? And what changes if the server runs on a four-core CPU? Below is a simple walkthrough and examples to make the difference crystal clear.
A stylized graphic titled "Concurrency vs Parallelism" with the text on the left and a diagram on the right showing many user icons sending requests to a Node server and CPU cores. The illustration contrasts how multiple requests are handled by the server/CPU.

Single-core example — concurrency by interleaving tasks

Consider a single-core CPU and three requests arriving at roughly the same time:
  1. The single core can execute only one instruction at a time. It chooses request 1 and begins processing.
  2. Request 1 performs a database fetch that takes some time (milliseconds).
  3. While request 1 is waiting for the database reply (I/O wait), the CPU switches to request 2 and runs code for that request.
  4. Request 2 does disk I/O and waits for the disk; while it waits, the CPU switches to request 3.
  5. When the database reply arrives for request 1, the CPU resumes request 1 and completes it.
Although many requests are “open” and making progress, at each instant the CPU executes only one request. The CPU keeps busy by switching between tasks so throughput is maximized. This interleaving of execution on a single core is called concurrency.
A stylized diagram titled "CONCURRENCY" showing a Node server with multiple clients sending requests. It illustrates a CPU/core processing req3 while req2 sits in a waiting queue and a timeline of req1, req2, and req3.

Multi-core example — parallelism by simultaneous execution

Now give the server four CPU cores. With four cores, four requests can literally run at the exact same instant — one on each core. That is parallelism: multiple things happening at the same time.
A stylized diagram titled "PARALLELISM" showing a Node server receiving four colored user requests and distributing them across four CPU cores, each core processing a request with progress bars.
Do more cores always make things faster? Usually yes for certain workloads, but it depends:
  • I/O-bound workloads (database queries, network calls, disk reads): a single core with non-blocking I/O can handle many concurrent connections efficiently because while one task waits, the CPU schedules another. Adding cores may give diminishing returns unless the workload is parallelizable or throughput requirements increase.
  • CPU-bound workloads (heavy computation like image processing, encryption, ML training): multiple cores help because work can be split and executed in parallel, reducing wall-clock time.

Quick comparison table

Node.js specifics

  • Node.js runs JavaScript primarily on a single main thread: the main event loop executes JS on one core by default.
  • Node’s non-blocking I/O is built on libuv and OS asynchronous I/O facilities. libuv also exposes a thread pool for some blocking operations (certain filesystem, crypto, DNS tasks), enabling high concurrency for I/O-heavy workloads on a single core.
  • To use all CPU cores for JS execution you must run multiple instances of the process and distribute incoming traffic across them (for example: cluster module, worker_threads, or an external process manager / load balancer).

Use the cluster module to fork multiple worker processes

You can spawn multiple worker processes (one per core or a fixed number) so each process gets scheduled on a different core by the OS:

Use worker_threads for CPU-heavy tasks

For compute-heavy tasks that would block the event loop, run them off the main thread with worker threads:
Quick mental model: use concurrency for I/O-bound workloads (a single core can manage many waiting tasks). Use parallelism for CPU-bound workloads (multiple cores perform work simultaneously).

Summary — key takeaways

  • Concurrency: multiple tasks make progress by interleaving on the same core. Great for I/O-heavy workloads.
  • Parallelism: multiple tasks run at the exact same time on multiple cores. Required for CPU-bound workloads to reduce elapsed time.
  • Node.js is single-threaded for JS execution; to leverage multiple cores you must use multiple processes or threads (cluster, worker_threads, or external orchestration).

Watch Video