Introduction
This is a small, un-scientific, comparison between node.js and AWS (Ada Web Server).
For node.js I've used both version 0.2.6 and 0.3.6 and since I could find no differences in performance, the following tests have all been done using version 0.3.6.
AWS is version 2.10.0, or rather the latest SVN checkout as per 22.01.11.
Please note that if the server that is being tested is really fast, a race condition will sometimes occur in ApacheBench. The result of this is that ApacheBench will show too many bytes transferred. This is not a bug in AWS.
Test Setup
I've done the tests on the following system:
- Slackware 13.1 x86_64, kernel 2.6.36.3.
- Intel Xeon CPU W3540 @ 2.93GHz
- 6 GB RAM
All tests were carried out 3 times, using the fastest result. It is worth noting that no discernible pattern came out of this. Sometimes the first run was the fastest, sometimes the final run. Neither software seemed to benefit from repeating the tests. I never experienced more than 2-3% fluctuation between runs. Usually the differences were within +/-0.01 second between each run.
The content delivered by the servers is:
<html><body>======Hello World======</body></html>
And the headers are:
Date: Sat Jan 22 2011 15:17:53 GMT+0100 (CET)
Server: node.js HTTP server
Content-Type: text/html
Content-Length: 46
Connection: keep-alive
200 OK
Date: Sat, 22 Jan 2011 14:18:18 GMT
Server: AWS (Ada Web Server) v2.10.0
Content-Type: text/html
Connection: keep-alive
Content-Length: 46
200 OK
All tests were done using ApacheBench, Version 2.3 <$Revision: 655654 $>.
Logging was disabled for AWS, though to AWS's credit it did not seem to matter all that much. AWS only takes a very small performance hit when logging is enabled, but since the node.js HTTP server did not have logging enabled, neither should AWS.
The code used by the node.js HTTP server is this:
var http = require('http'); http.createServer(function (req, res){ var date = new Date(); var body = '<html><body>======Hello World======</body></html>'; res.writeHead(200, {'Date': date, 'Server': 'node.js HTTP server', 'Content-Type': 'text/html', 'Content-Length': body.length}); res.end(body); }).listen(8124, "127.0.0.1"); console.log('Server running at http://127.0.0.1:8124/');
For AWS I've used this dispatcher:
AWS.Services.Dispatchers.URI.Register_Regexp (Dispatcher => Resource_Handler, URI => "/|/[[Ii]]ndex", Action => Create (Callback => View.Index.Generate'Access));
There appeared to be no discernible difference in speed between Register_Regexp and plain Register.
And then in View.Index.Generate:
return AWS.Response.Build ("text/html", "<html><body>======Hello World======</body></html>");
All AWS configuration settings were at default values, except maximum connections, which were set at 50 throughout all the tests.
The AWS server was compiled using GNAT GPL 2010 and -O2. node.js was compiled using GCC 4.4.4, using plain ./configure, make, make install as per the accompanying README.
The Tests
Now, for those of you who are a bit impatient (or who simply don't care for numbers), here's a few graphics of all the tests.
First with ApacheBench running on the same host as the servers:
And then with ApacheBench running on a remote host:
Clearly AWS is the “winner”, and more importantly: AWS even wins when only serving one client. So even in a scenario where there's no concurrency, AWS is faster. Read on if you want to see exactly how these two HTTP servers performed.
ab -n 50000 -c 1 (local)
Server Software: node.js Server Hostname: localhost Server Port: 8124 Document Path: / Document Length: 46 bytes Concurrency Level: 1 Time taken for tests: 7.241 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Total transferred: 10250000 bytes HTML transferred: 2300000 bytes Requests per second: 6904.94 [[#/sec]] (mean) Time per request: 0.145 [[ms]] (mean) Time per request: 0.145 [[ms]] (mean, across all concurrent requests) Transfer rate: 1382.34 [[Kbytes/sec]] received Connection Times (ms) min mean[[+/-sd]] median max Connect: 0 0 0.0 0 0 Processing: 0 0 0.1 0 7 Waiting: 0 0 0.1 0 7 Total: 0 0 0.1 0 7 Percentage of the requests served within a certain time (ms) 50% 0 66% 0 75% 0 80% 0 90% 0 95% 0 98% 0 99% 0 100% 7 (longest request)
Server Software: AWS
Server Hostname: localhost
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 1
Time taken for tests: 5.989 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200000 bytes
HTML transferred: 2300000 bytes
Requests per second: 8348.77 [[#/sec]] (mean)
Time per request: 0.120 [[ms]] (mean)
Time per request: 0.120 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1663.23 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 0.0 0 3
Waiting: 0 0 0.0 0 3
Total: 0 0 0.0 0 3
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 0
100% 3 (longest request)
Winner: AWS is ~17.3% faster than node.js.
ab -n 50000 -c 1 (remote)
Server Software: node.js
Server Hostname: thomas
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 1
Time taken for tests: 18.873 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 2649.33 [[#/sec]] (mean)
Time per request: 0.377 [[ms]] (mean)
Time per request: 0.377 [[ms]] (mean, across all concurrent requests)
Transfer rate: 530.38 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 18
Processing: 0 0 0.1 0 7
Waiting: 0 0 0.1 0 7
Total: 0 0 0.2 0 18
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 0
100% 18 (longest request)
Server Software: AWS
Server Hostname: thomas
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 1
Time taken for tests: 17.185 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200000 bytes
HTML transferred: 2300000 bytes
Requests per second: 2909.55 [[#/sec]] (mean)
Time per request: 0.344 [[ms]] (mean)
Time per request: 0.344 [[ms]] (mean, across all concurrent requests)
Transfer rate: 579.64 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 2
Processing: 0 0 0.1 0 18
Waiting: 0 0 0.1 0 18
Total: 0 0 0.1 0 18
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 0
100% 18 (longest request)
Winner: AWS is ~8.95% faster than node.js.
ab -n 50000 -c 5 (local)
Server Software: node.js
Server Hostname: localhost
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 5
Time taken for tests: 3.478 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 50000
Total transferred: 10500300 bytes
HTML transferred: 2300000 bytes
Requests per second: 14377.29 [[#/sec]] (mean)
Time per request: 0.348 [[ms]] (mean)
Time per request: 0.070 [[ms]] (mean, across all concurrent requests)
Transfer rate: 2948.55 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 0
Processing: 0 0 2.0 0 40
Waiting: 0 0 0.0 0 3
Total: 0 0 2.0 0 40
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 0
100% 40 (longest request)
Server Software: AWS
Server Hostname: localhost
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 5
Time taken for tests: 2.639 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200204 bytes
HTML transferred: 2300046 bytes
Requests per second: 18944.32 [[#/sec]] (mean)
Time per request: 0.264 [[ms]] (mean)
Time per request: 0.053 [[ms]] (mean, across all concurrent requests)
Transfer rate: 3774.14 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 1
Processing: 0 0 0.1 0 2
Waiting: 0 0 0.1 0 2
Total: 0 0 0.1 0 2
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 0
100% 2 (longest request)
Winner: AWS is ~24.12% faster than node.js.
ab -n 50000 -c 5 (remote)
Server Software: node.js
Server Hostname: thomas
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 5
Time taken for tests: 7.056 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 7086.38 [[#/sec]] (mean)
Time per request: 0.706 [[ms]] (mean)
Time per request: 0.141 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1418.66 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 2
Processing: 0 1 0.4 1 8
Waiting: 0 1 0.4 1 8
Total: 0 1 0.4 1 8
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 8 (longest request)
Server Software: AWS
Server Hostname: thomas
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 5
Time taken for tests: 3.545 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200204 bytes
HTML transferred: 2300046 bytes
Requests per second: 14106.35 [[#/sec]] (mean)
Time per request: 0.354 [[ms]] (mean)
Time per request: 0.071 [[ms]] (mean, across all concurrent requests)
Transfer rate: 2810.30 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 2
Processing: 0 0 0.1 0 3
Waiting: 0 0 0.1 0 3
Total: 0 0 0.1 0 4
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 1
99% 1
100% 4 (longest request)
Winner: AWS is ~49.76% faster than node.js.
ab -n 50000 -c 10 (local)
Server Software: node.js
Server Hostname: localhost
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 10
Time taken for tests: 5.432 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 9203.93 [[#/sec]] (mean)
Time per request: 1.086 [[ms]] (mean)
Time per request: 0.109 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1842.58 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 0
Processing: 0 1 0.6 1 9
Waiting: 0 1 0.6 1 9
Total: 0 1 0.6 1 9
Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 2
90% 2
95% 2
98% 2
99% 2
100% 9 (longest request)
Server Software: AWS
Server Hostname: localhost
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 10
Time taken for tests: 2.351 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200204 bytes
HTML transferred: 2300046 bytes
Requests per second: 21263.09 [[#/sec]] (mean)
Time per request: 0.470 [[ms]] (mean)
Time per request: 0.047 [[ms]] (mean, across all concurrent requests)
Transfer rate: 4236.09 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 2
Processing: 0 0 0.2 0 8
Waiting: 0 0 0.2 0 8
Total: 0 0 0.2 0 8
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 1
95% 1
98% 1
99% 1
100% 8 (longest request)
Winner: AWS is ~56.52% faster than node.js.
ab -n 50000 -c 10 (remote)
Server Software: node.js
Server Hostname: thomas
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 10
Time taken for tests: 6.739 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 7419.20 [[#/sec]] (mean)
Time per request: 1.348 [[ms]] (mean)
Time per request: 0.135 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1485.29 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 2
Processing: 0 1 0.7 1 10
Waiting: 0 1 0.7 1 10
Total: 0 1 0.7 1 10
Percentage of the requests served within a certain time (ms)
50% 1
66% 2
75% 2
80% 2
90% 2
95% 2
98% 2
99% 3
100% 10 (longest request)
Server Software: AWS
Server Hostname: thomas
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 10
Time taken for tests: 2.032 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200204 bytes
HTML transferred: 2300046 bytes
Requests per second: 24604.58 [[#/sec]] (mean)
Time per request: 0.406 [[ms]] (mean)
Time per request: 0.041 [[ms]] (mean, across all concurrent requests)
Transfer rate: 4901.79 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 2
Processing: 0 0 0.1 0 5
Waiting: 0 0 0.1 0 5
Total: 0 0 0.2 0 5
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 1
95% 1
98% 1
99% 1
100% 5 (longest request)
Winner: AWS is ~69.85% faster than node.js.
ab -n 50000 -c 50 (local)
Server Software: node.js
Server Hostname: localhost
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 50
Time taken for tests: 5.298 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 9437.63 [[#/sec]] (mean)
Time per request: 5.298 [[ms]] (mean)
Time per request: 0.106 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1889.37 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 1
Processing: 0 5 2.6 5 16
Waiting: 0 5 2.6 5 16
Total: 1 5 2.6 5 16
Percentage of the requests served within a certain time (ms)
50% 5
66% 7
75% 7
80% 8
90% 9
95% 9
98% 10
99% 12
100% 16 (longest request)
Server Software: AWS
Server Hostname: localhost
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 50
Time taken for tests: 2.030 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200000 bytes
HTML transferred: 2300000 bytes
Requests per second: 24633.08 [[#/sec]] (mean)
Time per request: 2.030 [[ms]] (mean)
Time per request: 0.041 [[ms]] (mean, across all concurrent requests)
Transfer rate: 4907.37 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 1 0.2 1 2
Processing: 0 1 0.4 1 26
Waiting: 0 1 0.4 1 25
Total: 1 2 0.4 2 27
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 2
90% 2
95% 2
98% 3
99% 3
100% 27 (longest request)
Winner: AWS is ~61.69% faster than node.js.
ab -n 50000 -c 50 (remote)
Server Software: node.js
Server Hostname: thomas
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 50
Time taken for tests: 5.912 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 8457.46 [[#/sec]] (mean)
Time per request: 5.912 [[ms]] (mean)
Time per request: 0.118 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1693.14 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 2
Processing: 0 6 2.9 6 19
Waiting: 0 6 2.9 6 19
Total: 0 6 2.9 6 19
Percentage of the requests served within a certain time (ms)
50% 6
66% 7
75% 8
80% 9
90% 10
95% 10
98% 11
99% 13
100% 19 (longest request)
Server Software: AWS
Server Hostname: thomas
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 50
Time taken for tests: 1.602 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200816 bytes
HTML transferred: 2300184 bytes
Requests per second: 31215.60 [[#/sec]] (mean)
Time per request: 1.602 [[ms]] (mean)
Time per request: 0.032 [[ms]] (mean, across all concurrent requests)
Transfer rate: 6219.23 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 2
Processing: 0 1 2.1 1 299
Waiting: 0 1 2.1 1 299
Total: 1 2 2.1 1 300
Percentage of the requests served within a certain time (ms)
50% 1
66% 2
75% 2
80% 2
90% 2
95% 2
98% 3
99% 3
100% 300 (longest request)
Winner: AWS is ~72.9% faster than node.js.
ab -n 50000 -c 100 (local)
Server Software: node.js
Server Hostname: localhost
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 100
Time taken for tests: 5.423 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 9219.82 [[#/sec]] (mean)
Time per request: 10.846 [[ms]] (mean)
Time per request: 0.108 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1845.76 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.0 0 1
Processing: 1 11 5.1 11 27
Waiting: 1 11 5.1 11 27
Total: 2 11 5.1 11 27
Percentage of the requests served within a certain time (ms)
50% 11
66% 13
75% 15
80% 16
90% 18
95% 18
98% 20
99% 23
100% 27 (longest request)
Server Software: AWS
Server Hostname: localhost
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 100
Time taken for tests: 2.011 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10203876 bytes
HTML transferred: 2300874 bytes
Requests per second: 24859.53 [[#/sec]] (mean)
Time per request: 4.023 [[ms]] (mean)
Time per request: 0.040 [[ms]] (mean, across all concurrent requests)
Transfer rate: 4954.37 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 1 0.3 1 3
Processing: 1 2 1.4 2 206
Waiting: 1 2 1.4 2 206
Total: 2 3 1.4 3 207
Percentage of the requests served within a certain time (ms)
50% 3
66% 3
75% 3
80% 3
90% 4
95% 4
98% 4
99% 4
100% 207 (longest request)
Winner: AWS is ~62.98% faster than node.js.
ab -n 50000 -c 100 (remote)
Server Software: node.js
Server Hostname: thomas
Server Port: 8124
Document Path: /
Document Length: 46 bytes
Concurrency Level: 100
Time taken for tests: 6.573 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10250000 bytes
HTML transferred: 2300000 bytes
Requests per second: 7607.10 [[#/sec]] (mean)
Time per request: 13.146 [[ms]] (mean)
Time per request: 0.131 [[ms]] (mean, across all concurrent requests)
Transfer rate: 1522.91 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 2
Processing: 1 13 6.4 13 34
Waiting: 1 13 6.4 13 34
Total: 1 13 6.4 13 34
Percentage of the requests served within a certain time (ms)
50% 13
66% 17
75% 18
80% 20
90% 22
95% 23
98% 24
99% 27
100% 34 (longest request)
Server Software: AWS
Server Hostname: thomas
Server Port: 4242
Document Path: /
Document Length: 46 bytes
Concurrency Level: 100
Time taken for tests: 1.584 seconds
Complete requests: 50000
Failed requests: 0
Write errors: 0
Total transferred: 10200204 bytes
HTML transferred: 2300046 bytes
Requests per second: 31558.36 [[#/sec]] (mean)
Time per request: 3.169 [[ms]] (mean)
Time per request: 0.032 [[ms]] (mean, across all concurrent requests)
Transfer rate: 6287.14 [[Kbytes/sec]] received
Connection Times (ms)
min mean[[+/-sd]] median max
Connect: 0 0 0.1 0 3
Processing: 1 2 5.3 2 301
Waiting: 0 2 5.3 2 301
Total: 1 2 5.3 2 301
Percentage of the requests served within a certain time (ms)
50% 2
66% 2
75% 2
80% 2
90% 2
95% 3
98% 3
99% 3
100% 301 (longest request)
Winner: AWS is ~75.9% faster than node.js.
Final Comments
None of the servers failed a single request. The inevitable conclusion is that AWS scales better and is faster than node.js. At least concurrency levels between 1 and 100.

