Skip to content

Instantly share code, notes, and snippets.

@mschwartz
Created June 26, 2012 14:29
Show Gist options
  • Save mschwartz/2996107 to your computer and use it in GitHub Desktop.
Save mschwartz/2996107 to your computer and use it in GitHub Desktop.

NodeJS v0.8.0

mschwartz@mschwartz:~/src/bench$ cat node.js
var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
mschwartz@mschwartz:~/src/bench$ node node.js 
Server running at http://127.0.0.1:1337/
mschwartz@mschwartz:~/src/bench$ ab -t 30 -k -c 50 http://localhost:1337/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        
Server Hostname:        localhost
Server Port:            1337

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      50
Time taken for tests:   5.375 seconds   <----
Complete requests:      50000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    0
Total transferred:      5650000 bytes
HTML transferred:       600000 bytes
Requests per second:    9301.52 [#/sec] (mean)   <-----
Time per request:       5.375 [ms] (mean) <-----
Time per request:       0.108 [ms] (mean, across all concurrent requests) <-----
Transfer rate:          1026.44 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.1      0       4
Processing:     0    5   2.8      5      19
Waiting:        0    5   2.8      5      19
Total:          0    5   2.8      5      19

Percentage of the requests served within a certain time (ms)
  50%      5
  66%      7
  75%      8
  80%      8
  90%      9
  95%      9
  98%     11
  99%     13
 100%     19 (longest request)

SilkJS

Note that SilkJS is also logging the requests to a log file and doing other work NodeJS doesn't do by default.

mschwartz@mschwartz:~/src/bench$ cat silk.js
Config.numChildren=100;
Config.requestsPerChild=100000;
function main_action() {
	res.write('Hello World\n');
	Server.endRequest();
}
mschwartz@mschwartz:~/src/bench$ httpd-silk.js silk.js 
30538 Started logfile process 30540
SilkJS HTTP running with 100 children on port 9090 from documentRoot /usr/local/silkjs/httpd/docroot


mschwartz@mschwartz:~/src/bench$ ab -t 30 -k -c 50 http://localhost:9090/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 5000 requests
Completed 10000 requests
Completed 15000 requests
Completed 20000 requests
Completed 25000 requests
Completed 30000 requests
Completed 35000 requests
Completed 40000 requests
Completed 45000 requests
Completed 50000 requests
Finished 50000 requests


Server Software:        SILK
Server Hostname:        localhost
Server Port:            9090

Document Path:          /
Document Length:        12 bytes

Concurrency Level:      50
Time taken for tests:   2.031 seconds <-----
Complete requests:      50000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    50000
Total transferred:      9800000 bytes
HTML transferred:       600000 bytes
Requests per second:    24621.64 [#/sec] (mean) <-----
Time per request:       2.031 [ms] (mean) <-----
Time per request:       0.041 [ms] (mean, across all concurrent requests) <-----
Transfer rate:          4712.74 [Kbytes/sec] received <-----

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    1  26.4      0    1000
Processing:     0    1  11.1      0     645
Waiting:        0    1  11.1      0     645
Total:          0    2  34.7      0    1644

Percentage of the requests served within a certain time (ms)
  50%      0
  66%      0
  75%      0
  80%      0
  90%      1
  95%      5
  98%     14
  99%     23
 100%   1644 (longest request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment