Skip to content

Commit 825af45

Browse files
committed
benchmark: Make http.sh more useful
1 parent 79ec9dc commit 825af45

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

benchmark/http.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,25 @@ sudo sysctl -w net.inet.tcp.msl=1000
55
sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000
66
ulimit -n 100000
77

8-
./node benchmark/http_simple.js || exit 1 &
8+
k=${KEEPALIVE}
9+
if [ "$k" = "no" ]; then
10+
k=""
11+
else
12+
k="-k"
13+
fi
14+
node=${NODE:-./node}
15+
16+
$node benchmark/http_simple.js &
17+
npid=$!
918
sleep 1
1019

11-
ab -n 30000 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} | grep Req
12-
killall node
20+
if [ "$k" = "-k" ]; then
21+
echo "using keepalive"
22+
fi
23+
24+
for i in a a a a a a a a a a a a a a a a a a a a; do
25+
ab $k -t 10 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} \
26+
2>&1 | grep Req | egrep -o '[0-9\.]+'
27+
done
28+
29+
kill $npid

0 commit comments

Comments
 (0)