Yammer is one of a growing number of companies running Node.js in production. At NodeConf today Yammer engineering lead Matt Eernisse shared some lessons the team has learned from running Node.js in production.

Code Organization

Iterative development in Node.js is easy - maybe a little too easy. Callbacks contribute to the confusion. You need to be careful or you'll quickly end up with spaghetti code.

App Dependencies

Dependencies are an issue for Node.js. NPM is improving - and Eernisse said he wishes it had been available when his team started working with Node - but it's not there yet. Neither are third-party modules. Yammer deals with this by "slurping up" all the dependencies, modifying them in-place and then pushing them back out.

Assume Things Are Going to Go Wrong

Eernisse says you should assume callbacks are going to go wrong and make the default condition an error message. Cancel the error if things work out. This is pretty common in the UI side. Log all the errors so that you can figure out what's going on later.

Visibility, Metrics

Eernisse says you should measure and log everything from the very beginning. Yammer uses this metric library.


Communicate with ops, because they are the ones that are going to have to deal with problems in the middle of the night.