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.
$ npm install --save use-max-cpu
const {startServer} = require('use-max-cpu');
const http = require('http');
startServer(() => {
console.log('Worker started..')
http.createServer((req, res) => {
res.writeHead(200);
res.end('hello world\n');
}).listen(8000);
})
MIT © Boris Joskic