Created
February 16, 2016 07:48
-
-
Save janbiasi/779954e9ff5bc682eb2b to your computer and use it in GitHub Desktop.
Zukunft. Namics. Snippets für das Node.js Clustermodul (Part 2)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var cluster = require('cluster'); | |
var numCPUs = require('os').cpus().length; | |
var proxy = require('./proxy'); | |
if (cluster.isMaster) { | |
for (var i = 0; i < numCPUs; i++) { | |
// Erstellt pro Kern einen neuen Worker | |
cluster.fork(); | |
} | |
} else { | |
// Erstellt den Proxy-Server | |
proxy.createServer(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment