Skip to content

Instantly share code, notes, and snippets.

@arunoda
Created September 12, 2011 11:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunoda/1211069 to your computer and use it in GitHub Desktop.
Save arunoda/1211069 to your computer and use it in GitHub Desktop.
Node HTTP Proxy Benchmark
var http = require('http');
var port = 1337;
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(port);
console.log('app stared in: %s', port);
/////
This log output has been taken from following bash command
ab -c 100 -n 10000 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)
Server Software:
Server Hostname: localhost
Server Port: 1337
Document Path: /
Document Length: 12 bytes
Concurrency Level: 100
Time taken for tests: 2.142 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 760000 bytes
HTML transferred: 120000 bytes
Requests per second: 4669.20 [#/sec] (mean)
Time per request: 21.417 [ms] (mean)
Time per request: 0.214 [ms] (mean, across all concurrent requests)
Transfer rate: 346.54 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 3 3.4 2 19
Processing: 0 19 10.0 19 63
Waiting: 0 17 9.6 17 63
Total: 1 21 9.7 21 63
Percentage of the requests served within a certain time (ms)
50% 21
66% 25
75% 28
80% 29
90% 34
95% 38
98% 43
99% 48
100% 63 (longest request)
var httpProxy = require('http-proxy');
var balancer = httpProxy.createServer(function (req, res, proxy) {
proxy.proxyRequest(req, res, {
host: 'localhost',
port: 1337
});
});
var port = 8081;
console.log('proxy stared in: %s', port);
balancer.listen(port);
This log output has been taken from following bash command
ab -c 100 -n 10000 http://localhost:8081/
===========================================================
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)
Server Software:
Server Hostname: localhost
Server Port: 8081
Document Path: /
Document Length: 22 bytes
Concurrency Level: 100
Time taken for tests: 8.768 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 1140000 bytes
HTML transferred: 220000 bytes
Requests per second: 1140.53 [#/sec] (mean)
Time per request: 87.679 [ms] (mean)
Time per request: 0.877 [ms] (mean, across all concurrent requests)
Transfer rate: 126.97 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 2.0 0 26
Processing: 10 87 19.2 87 152
Waiting: 10 87 19.2 87 151
Total: 11 87 19.0 87 152
Percentage of the requests served within a certain time (ms)
50% 87
66% 92
75% 97
80% 100
90% 111
95% 121
98% 134
99% 140
100% 152 (longest request)
OS: Ubuntu 10.10
NodeJS: v0.4.10
RAM: 2GB
Processer: Core 2 Duo 2.0 Ghz
OS: Ubuntu 10.10
NodeJS: v0.4.10
RAM: 2GB
Processer: Core 2 Duo 2.0 Ghz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment