var cluster = require('cluster');
var http = require('http');
var numCPUs = 100;
if (cluster.isMaster) {
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
} else {
console.log('created ' + process.pid)
http.createServer(function(req, res) {
res.writeHead(200);
res.end('process ' + process.pid + ' says hello!');
}).listen(8000);
}
npm install pm2@latest -g
pm2 start app.js -i 100