TJ Holowaychuk: Cluster Live 0.0.1
Cluster Live 0.0.1
cluster-live is a plugin for the Cluster server manager written for node. Cluster is similar to Ruby’s “Unicorn”, however is extremely extensible via a simple plugin system.
Cluster is built with the Express web framework, Jade for templates, Stylus for CSS, and Socket.IO for communication.
Below is a screenshot of cluster-live in action. Each worker process is represented by its own smoothie chart, showing the active connections, total connections, and requests issued to the worker. Connections appear as theblue line, and requests as gray, however in the screenshot below a single connection was issued per simulated request.
Administration
Currently the only administration task that can be performed from cluster-live is the spawning and removal of workers by pressing the plus or minus buttons in the top-right corner.
Example
Using cluster, and cluster-live is extremely simple, first install the modules:
$ npm install cluster cluster-live
Then initialize cluster with cluster(server)
, and use()
the stats()
plugin which produces the events that cluster-live uses for reporting, and then of course finally live()
itself.
var http = require('http')
, cluster = require('cluster')
, live = require('cluster-live');
var server = http.createServer(function(req, res){
res.end('Hello World');
});
cluster(server)
.set('workers', 4)
.use(cluster.stats({ connections: true, lightRequests: true }))
.use(live())
.listen(3000);
By default the cluster-live port is 8888
, so fire up 3000
and 8888
in your browser to see it in action. See the readme for information changing the port, host, or TLS options.
Future
This plugin is still very much a work-in-progress, but it’s somewhat usable for now although optimizations are still required in order to provide sufficient performance. With minimal profiling it seems that smoothie is currently one of the largest benchmarks but it is something I will have to dig into deeper. It would be great to add some more administration capabilities, as well as more reporting, as many statistics are still currently left out.
More Information
- cluster-live github repo
- cluster github repo
- cluster documentation
43 Notes/ Hide
- newsrankstar-blog liked this
- demetriusj-blog reblogged this from tjholowaychuk-blog
- jackbox55 liked this
- thedeveloper reblogged this from tjholowaychuk-blog
- jyorr liked this
- nodenerd-blog-blog liked this
- blogatom liked this
- rocketlabsdev-blog-blog liked this
- morgancraft-blog-blog-blog liked this
- oivoodoo liked this
- tjholowaychuk-blog posted this