cluster-forker
easy node clustering
A single instance of Node.js runs in a single thread. To take advantage of multi-core systems, the user will sometimes want to launch a cluster of Node.js processes to handle the load.
The ClusterForker allows easy creation of child processes that all share server ports.
Highlights
-
Written in Typescript
-
Wrapper for the
cluster
module -
Simple API
-
Lazy, doesn't actually fork before the
run
method is called -
The worker processes are spawned using the child_process.fork() method, so that they can communicate with the parent via IPC and pass server handles back and forth.
Installation
npm:
$ npm install cluster-forker
yarn:
$ yarn add cluster-forker
Usage
easy node clustering
//index.js const Cluster = ; let superCluster = ; let superCluster = ; superCluster // Runs the cluster and begins forking
$ node index> master is running> Worker 31889 is online> Worker 31890 is online> Worker 31891 is online> Worker 31892 is online
License
MIT © Nivrith