Why all examples of cluster mode in node.js forks to number of processes that equals number of CPUs?
var cluster = require('cluster');
var numCPUs = require('os').cpus().length;
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < numCPUs; i++) {
cluster.fork();
}
cluster.on('exit', function(worker, code, signal) {
console.log('worker ' + worker.process.pid + ' died');
});
} else {
// worker process
// do the job....
}
Is it possible to fork to higher number of processes? I've tried this code with 10 processes on core-4 and it seems to be working. But- is it a good idea?