Express 4 in production

/ Edit this post

Express 4 just got released thanks to the great work of @defunctzombie and the expressjs team.

The main change is, that Express does not have connect as a dependency anymore, which means that the bundled middlewares are no longer available in the express module. These should be installed and listed in your apps package.json. This allows faster updates of the middlewares without affecting the release cycles of express.

Migrating

The things you should pay attention to:

  • app.configure(): removed, no longer available
  • app.router: removed, no need to manually do it
  • express.createServer(): removed, use express()
  • public API for the Router

It took only a day to change to new version of express, in a medium size application like ours.

For more, please check the migrating guidelines and the list of new features.

In production

We have deployed to only one API node for testing purposes (after running it several days on our staging environment) just to see how it performs under heavy load. We are serving millions of requests every day so even in this setup the node with the new version still receives lots of requests.

In short: hats off! All of our metrics improved on the API node using the new version of Express:

  • response times dropped by 20%
  • memory consumption dropped by 10%

Conclusion

As you can see, the effort you have to put in to migrate the new version is very little compared to the performance gains. If you have at least integration tests to check if everything is okay, you should definitely start using the new version.