diff options
author | isaacs <i@izs.me> | 2012-04-11 01:59:21 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-04-18 00:14:55 +0400 |
commit | 45c1d4f96f48c30bd3036938fb922e050e76c2e0 (patch) | |
tree | f64b2bdf688792b0c8f1d60e3ab3a20ea53c8533 /benchmark | |
parent | 10ce3d129d4e466842a03545fdfdfc011e0b9fba (diff) |
Add switches to http_simple bench to use domains
Diffstat (limited to 'benchmark')
-rwxr-xr-x | benchmark/http.sh | 4 | ||||
-rw-r--r-- | benchmark/http_simple.js | 20 |
2 files changed, 23 insertions, 1 deletions
diff --git a/benchmark/http.sh b/benchmark/http.sh index 22b4b7c8c62..40d0c714c21 100755 --- a/benchmark/http.sh +++ b/benchmark/http.sh @@ -4,7 +4,9 @@ sudo sysctl -w net.inet.ip.portrange.first=12000 sudo sysctl -w net.inet.tcp.msl=1000 sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000 ulimit -n 100000 + ./node benchmark/http_simple.js || exit 1 & sleep 1 -ab -n 30000 -c 100 http://127.0.0.1:8000/bytes/123 | grep Req + +ab -n 30000 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} | grep Req killall node diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index 74ba4d77680..bd0a1c83647 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -14,7 +14,27 @@ for (var i = 0; i < 20*1024; i++) { stored = {}; storedBuffer = {}; +var useDomains = process.env.NODE_USE_DOMAINS; + +// set up one global domain. +if (useDomains) { + var domain = require('domain'); + var gdom = domain.create(); + gdom.on('error', function(er) { + console.log('Error on global domain', er); + throw er; + }); + gdom.enter(); +} + var server = http.createServer(function (req, res) { + + if (useDomains) { + var dom = domain.create(); + dom.add(req); + dom.add(res); + } + var commands = req.url.split("/"); var command = commands[1]; var body = ""; |