Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
test
LICENSE
README.md
index.js
package.json

README.md

Clusterstart

The purpose of this module is to enable an app created in Node.js to run either in cluster or on a signle core.

Installation

    $ npm install clusterstart

Commands

clusterstart allows you to import the clusterstart module into your app, then just run it as a cluster. $ node app.js --clusterize

It also allows you to specify the number of cores to run it on. $ node app.js --clusterize 4

If no number is passed, then it runs on all available cores. Likewise if the number passed in is more than the available cores, it will default to the available cores.

Example

var clusterstart = require('clusterstart'),
        http = require('http');

        http.Server(function(req, res) {
            res.writeHead(200);
            res.end("hello world\n");
        }).listen(8000);

And to run:

$ node app.js --clusterize

Testing:

There is simple test in the ./tests directory which spins up a server and trys different clusterizing options through child_process

$ npm test
Something went wrong with that request. Please try again.