Node, iOS, Android, HTML5, JavaScriptの話題。ときどきMacやLinux。 Nodeでは、クラスタを簡単に実装できます。こんなに簡単でいいのか。 server.js var cluster = require('cluster'); var http = require('http'); // CPUの数 var numCPUs = require('os').cpus().length; if(cluster.isMaster) { for(var i=0; i<numCPUs; i++) { // マスターだったらforkします var worker = cluster.fork(); console.log('worker forked: pid=' + worker.pid); } // worker終了時のイベントハンドラ cluster.on