# Node.js runtime: non-blocking I/O and scaling

*JavaScript Developer Study Guide · Server Side JavaScript · Last updated October 16, 2026 · https://www.certifyforce.com/study-guide/javascript-developer/server-side-javascript/nodejs-runtime-non-blocking-io-and-scaling*

How Node.js serves many connections from one thread, why synchronous and CPU-bound code stalls every request, and how to pick streams, worker_threads, cluster or child_process for large files, heavy computation and multi-core scaling.

- Certification: Salesforce JavaScript Developer
- Exam section: Server Side JavaScript
- Study guide: https://www.certifyforce.com/study-guide/javascript-developer

**Official exam objective:**

> Given a scenario and requirements, infer which Node.js implementation is a good solution.

## What the exam expects

- Describe the Node.js runtime model (V8 outside the browser, one process, non-blocking I/O) and say which workloads it suits.
- Predict the output order when synchronous (`*Sync`) and callback-based file reads are mixed.
- Keep a server responsive when one request does heavy CPU work, and reject fixes that only look asynchronous.
- Choose between `worker_threads`, `cluster` and `child_process` for multi-core scaling, and between `readFile` and a stream for large files.
- Recognise when a module-format change (`"type": "module"`) breaks `require` and how `.cjs` fixes it.

Key terms: **event loop** (the single thread that runs your JavaScript callbacks); **blocking** (more JavaScript must wait until a non-JavaScript operation finishes); **Worker Pool** (libuv's threadpool for expensive tasks such as file I/O); **worker thread** (a `Worker` running JavaScript in parallel inside the same process); **cluster** (several Node.js processes sharing one server port).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Runtime | V8 outside the browser; one process, no thread per request | [Introduction to Node.js](https://nodejs.org/learn/getting-started/introduction-to-nodejs) |
| When I/O blocks the process | Only when I/O uses the standard library's synchronous methods (a long-running callback also blocks the event loop) | [About Node.js](https://nodejs.org/en/about) |
| Blocking method names | Blocking counterparts of I/O methods end in `Sync` | [Overview of Blocking vs Non-Blocking](https://nodejs.org/learn/asynchronous-work/overview-of-blocking-vs-non-blocking) |
| `async` with no `await` | Runs synchronously | [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function) |
| Workers fit | CPU-intensive JavaScript; not much help for I/O-intensive work | [Worker threads](https://nodejs.org/api/worker_threads.html) |
| `cluster` | Child processes that share server ports; round-robin by default except on Windows | [Cluster](https://nodejs.org/api/cluster.html) |
| `UV_THREADPOOL_SIZE` | Sizes libuv's threadpool, default 4 | [Command-line API](https://nodejs.org/api/cli.html) |
| `fs.readFile()` memory | Buffers the entire file; prefer `fs.createReadStream()` | [File system](https://nodejs.org/api/fs.html) |
| `.cjs` / `.mjs` | Always CommonJS / always ES module, regardless of `type` | [Modules: Packages](https://nodejs.org/api/packages.html) |

## Check yourself

- Why can one Node.js process handle thousands of concurrent connections?
- When does a `readFile()` callback run relative to code written after it?
- When should you choose `worker_threads` over `cluster`?
- Which pattern reads a multi-gigabyte file one line at a time?

## Sources

- [Introduction to Node.js](https://nodejs.org/learn/getting-started/introduction-to-nodejs)
- [About Node.js](https://nodejs.org/en/about)
- [Overview of Blocking vs Non-Blocking](https://nodejs.org/learn/asynchronous-work/overview-of-blocking-vs-non-blocking)
- [Don't Block the Event Loop (or the Worker Pool)](https://nodejs.org/learn/asynchronous-work/dont-block-the-event-loop)
- [Worker threads](https://nodejs.org/api/worker_threads.html)
- [Cluster](https://nodejs.org/api/cluster.html)
- [Child process](https://nodejs.org/api/child_process.html)
- [Readline](https://nodejs.org/api/readline.html)
- [File system](https://nodejs.org/api/fs.html)
- [Command-line API](https://nodejs.org/api/cli.html)
- [Differences between Node.js and the Browser](https://nodejs.org/learn/getting-started/differences-between-nodejs-and-the-browser)
- [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function)
- [Promise() constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/Promise)
- [Modules: Packages](https://nodejs.org/api/packages.html)
- [Modules: CommonJS modules](https://nodejs.org/api/modules.html)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit and reading progress are included in the full study guide. The separate practice exams option includes the reviewed question bank and timed mock exams. The bundle includes both where available. See [current options and prices](https://www.certifyforce.com/pricing).
