diff options
author | isaacs <i@izs.me> | 2012-12-18 14:44:32 -0800 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-12-21 00:07:34 +0000 |
commit | 836593da23f753cb687ed0ee97410d635cf04c9f (patch) | |
tree | 7d207aefe1b30f2b376c88a6a8923fc0b710a2ae | |
parent | 7475982801939e89528c90629cbbf76cb9fc604c (diff) | |
download | node-836593da23f753cb687ed0ee97410d635cf04c9f.tar.gz |
benchmark: Improve http-flamegraph
-rw-r--r-- | benchmark/http-flamegraph.sh | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/benchmark/http-flamegraph.sh b/benchmark/http-flamegraph.sh index ad1f6a22a..0e7bf8431 100644 --- a/benchmark/http-flamegraph.sh +++ b/benchmark/http-flamegraph.sh @@ -1,5 +1,8 @@ #!/bin/bash cd "$(dirname "$(dirname $0)")" + +node=${NODE:-./node} + if type sysctl &>/dev/null; then sudo sysctl -w net.inet.ip.portrange.first=12000 sudo sysctl -w net.inet.tcp.msl=1000 @@ -7,33 +10,40 @@ if type sysctl &>/dev/null; then fi ulimit -n 100000 -./node benchmark/http_simple.js & +$node benchmark/http_simple.js & nodepid=$! echo "node pid = $nodepid" sleep 1 # has to stay alive until dtrace exits -dtrace -n 'profile-97/pid == '$nodepid' && arg1/{ @[jstack(150, 8000)] = count(); } tick-60s { exit(0); }' > stacks.src & +dtrace -n 'profile-97/pid == '$nodepid' && arg1/{ @[jstack(150, 8000)] = count(); } tick-60s { exit(0); }' \ + | grep -v _ZN2v88internalL21Builtin_HandleApiCallENS0_12_GLOBAL__N_116BuiltinA \ + > stacks.src & + dtracepid=$! + echo "dtrace pid = $dtracepid" +sleep 1 + test () { - n=$1 - c=$2 - k=$3 - ab $k -n $n -c $c http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} \ + c=$1 + t=$2 + l=$3 + k=$4 + ab $k -t 10 -c $c http://127.0.0.1:8000/$t/$l \ 2>&1 | grep Req } -test 10000 100 -test 10000 10 -k -test 10000 100 -k -test 30000 100 -k -test 60000 100 -k +#test 100 bytes 1024 +#test 10 bytes 100 -k +#test 100 bytes 1024 -k +#test 100 bytes 1024 -k +#test 100 bytes 1024 -k echo 'Keep going until dtrace stops listening...' while pargs $dtracepid &>/dev/null; do - ab -k -n 60000 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} 2>&1 | grep Req + test 100 bytes 1 -k done kill $nodepid |