A very simple DIY cluster,
JavaScript
Latest commit ce7e656 Nov 30, 2011 @windyrobin change coding style
Failed to load latest commit information.
Readme.md Update Readme.md Oct 26, 2011
master.js change coding style Nov 30, 2011
tcpMaster.js change coding style Nov 30, 2011
tcpWorker.js change coding style Nov 30, 2011
worker.js change coding style Nov 30, 2011

Readme.md

iCluster

Compare to multi-node or node-cluster ,it's very simple/fast and easy to mantain/hack ,so you could write you own cluster based on it.

Working on v0.5.9+

Features

It supports two strategies for multi-process:

  • multi worker processes listen on the same port
  • the master receives the incoming sockets and distributes them to workers

Performance

In my test machine , CPU X 5 ,it could reach 10K qps for task like below:

server = http.createServer(function(req, res){
  var i,r;
  for(i=0; i<10000; i++){
    r = Math.random();
  }   
  res.writeHead(200 ,{"content-type" : "text/html"});
  res.end("hello,world");
  child_req_count++;
});

How to use

download the source

$ node master.js
$ curl localhost:3458/

or you could test the tcpMaster:

$ node tcpMaster.js 
$ curl localhost:3458/

just enjoy it

weibo : http://weibo.com/windyrobin