diff options
author | isaacs <i@izs.me> | 2012-12-19 09:19:06 -0800 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-12-21 00:07:34 +0000 |
commit | 825af451fbd5216ee44ecdf5f9f68244743b2e6b (patch) | |
tree | 44d6d3035abb5821f27095edcf76d2eb110cf8a3 | |
parent | 79ec9dc1dd09a3d05417b95f7c8bf5177e360153 (diff) | |
download | node-825af451fbd5216ee44ecdf5f9f68244743b2e6b.tar.gz |
benchmark: Make http.sh more useful
-rwxr-xr-x | benchmark/http.sh | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/benchmark/http.sh b/benchmark/http.sh index 40d0c714c..b5c5388ad 100755 --- a/benchmark/http.sh +++ b/benchmark/http.sh @@ -5,8 +5,25 @@ 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 & +k=${KEEPALIVE} +if [ "$k" = "no" ]; then + k="" +else + k="-k" +fi +node=${NODE:-./node} + +$node benchmark/http_simple.js & +npid=$! sleep 1 -ab -n 30000 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} | grep Req -killall node +if [ "$k" = "-k" ]; then + echo "using keepalive" +fi + +for i in a a a a a a a a a a a a a a a a a a a a; do + ab $k -t 10 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} \ + 2>&1 | grep Req | egrep -o '[0-9\.]+' +done + +kill $npid |