doc: mention `binary` as deafult for Hash strings
[platform/upstream/nodejs.git] / benchmark / http.sh
1 #!/bin/bash
2 cd "$(dirname "$(dirname $0)")"
3
4 if type sysctl &>/dev/null; then
5   # darwin and linux
6   sudo sysctl -w net.ipv4.ip_local_port_range="12000 65535"
7   sudo sysctl -w net.inet.ip.portrange.first=12000
8   sudo sysctl -w net.inet.tcp.msl=1000
9   sudo sysctl -w kern.maxfiles=1000000 kern.maxfilesperproc=1000000
10 elif type /usr/sbin/ndd &>/dev/null; then
11   # sunos
12   /usr/sbin/ndd -set /dev/tcp tcp_smallest_anon_port 12000
13   /usr/sbin/ndd -set /dev/tcp tcp_largest_anon_port 65535
14   /usr/sbin/ndd -set /dev/tcp tcp_max_buf 2097152
15   /usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat 1048576
16   /usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat 1048576
17 fi
18
19 ulimit -n 100000
20
21 k=${KEEPALIVE}
22 if [ "$k" = "no" ]; then
23   k=""
24 else
25   k="-k"
26 fi
27 node=${NODE:-./node}
28
29 $node benchmark/http_simple.js &
30 npid=$!
31
32 sleep 1
33
34 if [ "$k" = "-k" ]; then
35   echo "using keepalive"
36 fi
37
38 for i in a a a a a a a a a a a a a a a a a a a a; do
39   ab $k -t 10 -c 100 http://127.0.0.1:8000/${TYPE:-bytes}/${LENGTH:-1024} \
40     2>&1 | grep Req | egrep -o '[0-9\.]+'
41 done
42
43 kill $npid