Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
parade is a cluster manager and also a process monitor for node.js applications
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
example
lib
public
test
views
.gitignore
.travis.yml
LICENSE
README.md
index.js
package.json

README.md

parade

parade is a cluster manager and also a process monitor for node.js applications. It forks multiple instances (process) of your application based on the number of cores available in the CPU and provides restful endpoints that provide data to track status, memory and cpu for individual node processes and servers.

NPM Version Build Status

Why Parade

  • nodejs runs on single thread which would not fully utilize all cores available in the server. parade is a command line utility which forks multiple worker process of the application to fully utilize all the cores of the server.

  • It helps to keep the application running forever without any downtime by automatically forking new workers whenever a worker process dies.

  • It helps to manage multiple worker processes by giving availability and usage stats on a web api.

  • Its open source and will remain open source.

Installation

$ npm install -g parade

Start the app

$ parade <app.js> [clusters]

Arguments

  • app.js: the main js file of your application
  • clusters (optional): # of worker process to fork. By default, it is set to (# of cores - 1)

Examples

To run your app

$ parade app.js
$ parade app.js 3

To run the example in this module

$ parade example/app.js
$ parade example/app.js 3

Argument 3, worker file name: example/app.js
Number of process forks  : 3
parade web api server running in 5667
Worker is online, Worker ID :  1
Worker is online, Worker ID :  2
Worker is online, Worker ID :  3

Tests

$ npm install
$ npm test

Rest Endpoints

Start the app with parade and test the following rest end points

$ parade app.js

Stats

It gets metrics of all worker processes

http://localhost:5667/api/stats

Sample result

{
  "processStats": [
    {
      "pid": 12335,
      "memory": 39047168,
      "cpu": 0
    },
    {
      "pid": 12337,
      "memory": 42954752,
      "cpu": 0
    }
  ],
  "osStats": {
    "totalMem": 4009091072,
    "freeMem": 1395204096,
    "cpus": [
      {
        "model": "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz",
        "speed": 2599,
        "times": {
          "user": 125852300,
          "nice": 334700,
          "sys": 59101600,
          "idle": 108351690500,
          "irq": 54764100
        }
      },
      {
        "model": "Intel(R) Xeon(R) CPU E5-2670 0 @ 2.60GHz",
        "speed": 2599,
        "times": {
          "user": 57877800,
          "nice": 343100,
          "sys": 31694400,
          "idle": 108823011800,
          "irq": 0
        }
      }
    ],
    "loadAvg": [
      0,
      0,
      0
    ],
    "uptime": 10986836.192939406,
    "platform": "linux"
  }
}

Status

It gets the status of all worker processes

http://localhost:5667/api/status

Sample result

{
  "1": {
    "workerId": 1,
    "uniqueId": 1,
    "processId": 12335,
    "status": "ONLINE"
  },
  "2": {
    "workerId": 2,
    "uniqueId": 2,
    "processId": 12337,
    "status": "ONLINE"
  }
}

Credits

License

The MIT License

Something went wrong with that request. Please try again.