Why So Many DevOps Tools Are Written in Node.js

Node.js logo

Node.js logo If you’ve been following the growth of either DevOps or Node.js you may have noticed the number of deployment, monitoring and automation tools being created in Node.js. One of the most recent example is Dreadnot, a deployment automation tool created by RackSpace Cloud Monitoring, which is based on Deployinator another Node.js based automation tool created by Etsy (Update: this is actually Ruby based, but Etsy uses Node.js for other DevOpsy things). And of course Joyent has been using Node.js internally for cloud management.

I talked to Tom Hughes-Croucher, the principal of the Node.js consulting firm Jetpacks for Dinosaurs and author of Up and Running with Node.js from O’Reilly about why this might be the case.

He explained that although there are plenty of companies using Node.js to build all new end-user facing applications, quite a few companies are using Node.js as a layer on existing infrastructure. Even relatively new companies like Yammer have found an advantage in using Node.js as a proxy for its API.

Hughes-Croucher notes that DevOps people tend to have more familiarity with Ruby than JavaScript (Chef recipes are written in Ruby, for one thing), so the use of Node.js for infrastructure tools is no accident. Instead he suggests the system’s architecture is the reason it’s so popular for tasks like keeping services running, generating alerts and provisioning resources.

Node.js has a couple distinct advantages for infrastructure maintenance:

1. It has a small footprint
2. The event-based nature of Node.js helps keep servers from getting bogged down handling time consuming tasks.

It helps to understand what event-based means in this context. Here’s an explanation from Dan York, who uses a fast food restaurant as an analogy:

The thread-based way would be to get to the front of the line, give your order to the cashier and then wait right there until your order was cooked and given to you. The cashier would not be able to help the next person until you got your food and went on your way. Need to service more customers… just add more cashiers!

Of course, we know that fast food restaurants don’t work that way. They are very much event-driven in that they try to make those cashiers as efficient as possible. As soon as you place your order, it’s sent off for someone to fulfill while the cashier is still taking your payment. When you are done paying, you have to step aside because the cashier is already looking to service the next customer. In some restaurants, you might even be given a pager that will flash and vibrate when your order is ready for pickup (My local Panera Bread does this). The key point is that you are not blocking the receiving of new orders.

Other asynchronous frameworks include Twisted (for Python) and Netty (for Java). Nginx is a general purpose asynchronous Web server that gaining a lot of traction.

If you want to know more about Node.js and how it’s being used in the enterprise, be sure to follow our coverage of NodeSummit. We’ll be there broadcasting live from theCube.