Node.js performance: Node.js vs io.js
Posted Feb 18, 2015 | 3 min. (460 words)You may already be aware that Raygun uses Node.JS for our API nodes that receive your precious crash reporting data (we also do node.js crash reporting if you’re interested). We’ve peaked in the past at more than 110,000 requests per second coming through to Raygun, so performance of our API is important.
What you may not know is that recently Node.JS was forked, and there are now two implementations growing in the community: node.js & io.js.
While there’s plenty more to say about io.js, one of the key focuses was on upgrading the Chrome V8 implementation. The version still in use with Node itself was rather old and completely unsupported by Google.
This led me to wonder, what’s the performance implications of this?
The test
We’re testing for raw requests-per-second, nothing more. For that reason, we run a benchmark that throws requests at an end point and gets a simple response.
Blank Express App – Using Express middle-ware, but returning a basic ‘hello world’ response.
Raw App – Using no middle-ware, returning a basic ‘hello world’ response.
We ran the test with batches of 20,000 calls, averaging out the throughput.
We ran the tests on:
- Node 0.10.25
- Node 0.10.36
- Node 0.12.0
- io.js 1.20
Important note: We also did not do any clustering, this is a single node process running on a single core with ApacheBench running on the same machine. You should be able to get better performance out of production hardware, with clustering, etc. This is a micro benchmark after all.
The results
<th>
Express.js RPS
</th>
<th>
Raw HTTP RPS
</th>
<td>
2079
</td>
<td>
3010
</td>
<td>
1940
</td>
<td>
2813
</td>
<td>
2002
</td>
<td>
2872
</td>
<td>
2200
</td>
<td>
3152
</td>
The winner
Right now, io.js wins the performance race here. Also, it seems that node.js is improving slowly which is great. I suspect that with new competition, we’ll see some more improvements.
Another thing to note was the impact of Express. Express is a super powerful framework, but if you’re only using it for nice routing, it may not be worth it (e.g. for an API).
What will we do with Raygun?
At present, io.js is pretty new and even the team behind it have not advocated it for production use yet. As we want our crash reporting solution to be rock solid for our customers, we’ll keep a close eye on io.js and start testing in production once the backing team suggest it’s ready.
Of course, things always change too, so we’ll be running benchmarks in future to see if the Node.js team can close the gap.
We’re all about performance, if you care about software quality too, you might want to try out Raygun to track your app crashes & errors!