var http = require('http') var fs = require('fs') http.createServer(function (req, res) { res.writeHead(200, {'Content-Type': 'text/plain'}) res.end("hello world") }).listen(3000);
This is just run with node server.js
ab -n 100000 -c100 http://localhost:3000/
Requests per second: 1339.35 [#/sec] (mean)
Requests per second: 1019.17 [#/sec] (mean)
Requests per second: 2899.45 [#/sec] (mean)
Requests per second: 4085.26 [#/sec] (mean)
for x in xrange(100000000): x + 1
time python test.py
real 0m13.531s user 0m13.487s sys 0m0.060s
real 0m10.337s user 0m10.302s sys 0m0.054s
real 0m9.177s user 0m9.120s sys 0m0.040s
real 0m8.909s user 0m8.897s sys 0m0.012s
The first iterations of this had node clustered with 2 forks, incrementing a remote redis counter, and ab being run from a remote machine. While the numbers were higher ( about 50% ) they were proportionally the same. This version just removes all variables.
I understand ab isn't exact but it's margin of error is tight enough to make it suitable for a ballpark. I've worked with Joyent and Amazon in the past. Infact I pulled 100 machines off AWS and put them on Joyent precisely because my own benchmarks - much more thorough than this - showed Joyent being 5 - 10 times faster.
When I ran the above I expected Joyent to completely demolish AWS.
I'm happy to be told I've done something terribly wrong. In fact I'm hoping for it.
I'd be interested to see how wrk performs here too.
Also, just for anyone else who's tempted to copy/paste the Content-Length snippet - it should technically be
'Content-Length': Buffer.byteLength(body)
- have been bitten by this before!