- ruby 1.9.3p194
- async_sinatra (1.0.0)
- thin (1.2.11)
thin start
ab -n 10000 -c 100 http://127.0.0.1:3000/
Server Software: thin
Server Hostname: 127.0.0.1
Server Port: 3000
Document Path: /
Document Length: 11 bytes
Concurrency Level: 100
Time taken for tests: 5.439 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1530000 bytes
HTML transferred: 110000 bytes
Requests per second: 1838.52 [#/sec] (mean)
Time per request: 54.391 [ms] (mean)
Time per request: 0.544 [ms] (mean, across all concurrent requests)
Transfer rate: 274.70 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 1 2.0 1 37
Processing: 15 53 10.8 52 119
Waiting: 12 49 10.1 48 96
Total: 25 54 10.6 53 119
Percentage of the requests served within a certain time (ms)
50% 53
66% 57
75% 61
80% 62
90% 65
95% 72
98% 78
99% 94
100% 119 (longest request)
- node v0.8.8
- express 3.0.0rc4
node app.js
ab -n 10000 -c 100 http://localhost:3001/
Server Software:
Server Hostname: 127.0.0.1
Server Port: 3001
Document Path: /
Document Length: 170 bytes
Concurrency Level: 100
Time taken for tests: 14.909 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 3290000 bytes
HTML transferred: 1700000 bytes
Requests per second: 670.71 [#/sec] (mean)
Time per request: 149.095 [ms] (mean)
Time per request: 1.491 [ms] (mean, across all concurrent requests)
Transfer rate: 215.49 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.8 0 21
Processing: 2 148 84.1 146 405
Waiting: 2 148 84.1 146 405
Total: 2 148 84.1 146 405
Percentage of the requests served within a certain time (ms)
50% 146
66% 192
75% 218
80% 233
90% 263
95% 281
98% 299
99% 312
100% 405 (longest request)
Ruby still has it (besides being a beautiful language).
It seems hardly fair to return the simple "hello async" 11 byte string in your Sinatra payload, and have your Node.js Express payload return a full HTML5 page at 170 bytes along with a favicon, style.css, headers and whatever else for a total of 329 bytes.
If you change your index.js file to be equivalent by switching
res.render('index', { title: 'Express' });tores.send("hello async");, then Node turns the tables on Sinatra real fast. Don't get me wrong - I love me some Ruby - but there's no scenario I've seen where a true apples-to-apples comparison has Ruby coming out ahead on performance. Elegance and beauty though, that's another metric entirely, albeit subjective.Server Hostname: 127.0.0.1 Server Port: 3001 Document Path: / Document Length: 11 bytes Concurrency Level: 100 Time taken for tests: 2.701 seconds Complete requests: 10000 Failed requests: 0 Write errors: 0 Total transferred: 1690000 bytes HTML transferred: 110000 bytes Requests per second: 3702.67 [#/sec] (mean) Time per request: 27.008 [ms] (mean) Time per request: 0.270 [ms] (mean, across all concurrent requests) Transfer rate: 611.09 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 0 0.8 0 48 Processing: 2 27 9.3 23 80 Waiting: 2 27 9.3 23 80 Total: 6 27 9.1 23 81 Percentage of the requests served within a certain time (ms) 50% 23 66% 25 75% 29 80% 31 90% 35 95% 49 98% 60 99% 66 100% 81 (longest request)