Chaos Monkey implemented as Node.js Express-compatible middleware…
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.

build status

Chaos Monkeyware

The Chaos Monkey is an idea originally outlined by the Netflix tech team.

The basic idea is to have something in your stack that causes random failures in your system, so you’ll be forced to make your app resillient against random failure.

The original Chaos Monkey (available on Github) worked by killing servers and processes at random in a distributed cloud infrastructure.

What is it?

Chaos Monkeyware works on a smaller scale. It is a Express/Connect compatible middleware for Node.js web applications that causes random failures. The failure propability is configurable (default is 10%).

The currently included failure modes (called mischiefs) are:

  • Crash – exits the Node.js process before it has a chance to respond to the HTTP request. I hope you have a process monitor…
  • Delay – provides the normal HTTP response, but with an added (random) delay of 1-10 seconds.
  • HTTP 403 Access Denied
  • HTTP 404 Not Found
  • HTTP 500 Internal Server Error

Currently, all of these mischiefs have equal propability. Future releases might support adjusting their probability individually or even disabling some of them individually.


It is used as any other Connect/Express compatible middleware.


var app = require('connect')()
  .use(function(req, res){
    res.end('hello world\n');


var flatiron = require('flatiron');

app = new flatiron.App();

app.http.before = [
    logger: app.log.warn



var apiserver = restify.createServer(serverOptions);

// If not on production, enable the Chaos Monkeyware middleware.
if (process.env.NODE_ENV !== 'production') {
    logger: console.log,
    probability: 0.2