0.0.4 • Published 11 years ago

mushroom v0.0.4

Weekly downloads
19
License
-
Repository
-
Last release
11 years ago

Mushroom

Manages multiple Node processes better than forever+cluster

Alpha, use at your own risk

Mushroom is like forever combined with cluster. It succinctly provides the ability to launch a Node process to serve on a port and restart it when it crashes, while providing a simple way for child processes to report performance data to the master.

Mushroom offers:

  • The means to keep one or more Node instances alive even when they crash
  • Performance and health tracking of instances

Child processes report back to the master over HTTP (intentionally not IPC or a pipe) with status information, like memory used and a tally of performance events. Child process stdout and stderr are also consumed and aggregated by the master. Mushroom is intended for scenarios where a load balancer (e.g. nginx or hardware) balances to one or many servers, each with a Mushroom master which controls many processes ("spores") on known ports. It is possible to make the master act as the load balancer but Mushroom was designed for an external one for reasons of performance, low latency and scalability.

Installation

npm install mushroom

Usage

Master (e.g. master.js)

var shroom = require("mushroom").shroom;

shroom.spawn(["main.js"], 2000);
shroom.spawn(["main.js"], 2001);
shroom.spawn(["main.js"], 2002);

Spore (e.g. main.js)

var spore = require("mushroom").spore();
var http = require("http");

http.createServer(function(request, response)
{
	spore.tally("hit", 1, {url: request.url});
	
}).listen(spore.port);
0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago