- With just a few lines of code you can significantly increase the performance of your Node/Express applications!
server-basic.js
contains a minimalist Node/Express serverserver-cluster.js
contains the same server forked using the Nodecluster
module.
- You can compare the performance of each server with Siege, an awesome HTTP load testing utility.
- The below comparison was generated using the siege command
siege -b -c 255 -t 15S http://localhost:3000
- Use
npm install
to grab the required node modules - Install the Siege command line tool by following the steps outlined in this blog post
- Run the basic server via
npm run basic
- In another terminal window, test the server's performance via
npm run siege
or create a custom siege test of your choosing - Once the test is complete, shut down the basic server and run the cluster server via
npm run cluster
- Test the cluster server with the same test you ran on the basic server
- Once the second test is complete, you can compare each servers' performance via the terminal log or view more detailed log results from Siege in
/usr/local/var/siege.log
- Load Testing your Site with Siege
- Node Cluster Module Docs
- Sitepoint Tutorial
- Throng, an awesome library to assist in managing clustered Node apps in production