Playing with Node.js

Today I decided to have a look at Node.js. I have heard quite a lot about it but have avoided looking at it for a while. Node.js provides a way of building server side network programs, written in Javascript. I took a look at a tutorial over at http://simonwillison.net/2009/Nov/23/node/ for installing Node and building a simple Hello World web service. I ran an apache benchmark test and was suprised with the results. I managed to get 6075 requests per second on my Macbook Pro!

To compare it with something that I'm used to, I wrote the same Hello World script service Sinatra and served it up using the thin webserver, which gave me 1606 requests per second which is quite a difference.

The 2 scripts and apache benchmark outputs are below:

Posted by Matt Fri, 19 Feb 2010 22:47:00 GMT


Monit Aggregator - A Sinatra interface for Monit

I use Monit to keep an eye on server processes and restart them if they go down. It comes with a useful web interface that gives you an overview of your servers health, and what processes are up/down. If you have a lot of servers then it can be a bit of a pain because you have to access each web Interface with a different URL.

This weekened I wrote a Sinatra app that aggregates the data from each web interface and displays it all on one page. The source is on Github.

It currently does not support HTTPS, and it only currently displays the overall system and individual processes.

 

To get going, install the dependant gems

gem install sinatra nokogiri haml

 

Now clone the repo

git clone git://github.com/mattfawcett/monit-aggregator.git

 

Then edit the monit_installations.yml file to include the details of each of your Monit web servers. To start the app running just type

ruby app.rb

 

Open your browser to http://yourdomain.com:4567

Alternatively you could run with Passenger.

There is also a free hosted version available on my server monitoring site Runs Like Clockwork

Posted by Matt Sun, 05 Jul 2009 16:41:00 GMT