Skip to content

Instantly share code, notes, and snippets.

@jorgeguberte
Created September 17, 2013 01:00
Show Gist options
  • Save jorgeguberte/6588808 to your computer and use it in GitHub Desktop.
Save jorgeguberte/6588808 to your computer and use it in GitHub Desktop.
var cluster = require('cluster');
if(cluster.isMaster){
var cpuCount = require('os').cpus().length;
for(var i=0; i<cpuCount;i++){
cluster.fork(); //Creates a worker
}
}else{
//App goes here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment