2 machines on EC2 of type m3.xlarge.
First one with ubuntu server.
Second one win2008r2.
node.js on ubuntu using the basic example to return a string response to any request.
asp.net httphandler to return the same response.
using https://github.com/newsapps/beeswithmachineguns I used 10 machines to execute 200000 with concurrency of 2000 (200 per machine) I ran the benchmark and got:
Complete requests: 200000
Requests per second: 5605.170000 [#/sec] (mean)
Time per request: 358.071900 [ms] (mean)
50% response time: 31.000000 [ms] (mean)
90% response time: 239.300000 [ms] (mean)
Complete requests: 200000
Requests per second: 9263.810000 [#/sec] (mean)
Time per request: 215.992900 [ms] (mean)
50% response time: 214.000000 [ms] (mean)
90% response time: 244.000000 [ms] (mean)
The nodeJS code is:
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.end('Some response\n');
}).listen(80);
The httphandler code is:
context.Response.Write("Some response\n" + Guid.NewGuid().ToString("N"));
I thought node js will be much faster, did I do something wrong?
after using the cluster module I got 16685 request per second from the node js I"m going to bring up the strongest EC2 instances and check on them
An m3.xlarge instance has a few cpu cores, whereas node.js is single-threaded. You can try to benchmark the node.js cluster module and see if using more CPU's helps. And, since node.js is quite new, make sure to use the latest stable series (0.8.x at the time of writing this).