16.4 The cluster Module
In general, applications based on Node.js run in a thread. However, with the methods of the child_process module, you’re able to run worker processes and swap out parts of your application from the main thread. A similar approach is taken by the cluster module of the Node.js platform. This module is based on the functionality of the child_process module to create worker processes. This module enables a kind of load balancing for Node.js applications. You can use it to start multiple types of HTTP servers or Transmission Control Protocol (TCP) servers on systems with multiple processor cores. These run in separate processes, enabling a better utilization of available resources.
The entry point into this process pool ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access