2012-03-07 03:19:11 +01:00
|
|
|
#!/bin/bash
|
|
|
|
cd "$(dirname "$(dirname $0)")"
|
2012-12-20 00:27:21 +01:00
|
|
|
|
|
|
|
if type sysctl &>/dev/null; then
|
|
|
|
# darwin and linux
|
2012-12-28 06:12:43 +01:00
|
|
|
sudo sysctl -w net.ipv4.ip_local_port_range="12000 65535"
|
2012-12-20 00:27:21 +01:00
|
|
|
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
|
|
|
|
elif type /usr/sbin/ndd &>/dev/null; then
|
|
|
|
# sunos
|
|
|
|
/usr/sbin/ndd -set /dev/tcp tcp_smallest_anon_port 12000
|
|
|
|
/usr/sbin/ndd -set /dev/tcp tcp_largest_anon_port 65535
|
|
|
|
/usr/sbin/ndd -set /dev/tcp tcp_max_buf 2097152
|
|
|
|
/usr/sbin/ndd -set /dev/tcp tcp_xmit_hiwat 1048576
|
|
|
|
/usr/sbin/ndd -set /dev/tcp tcp_recv_hiwat 1048576
|
|
|
|
fi
|
|
|
|
|
2012-03-07 03:19:11 +01:00
|
|
|
ulimit -n 100000
|
2012-04-10 23:59:21 +02:00
|
|
|
|
2012-12-19 18:19:06 +01:00
|
|
|
k=${KEEPALIVE}
|
|
|
|
if [ "$k" = "no" ]; then
|
|
|
|
k=""
|
|
|
|
else
|
|
|
|
k="-k"
|
|
|
|
fi
|
|
|
|
node=${NODE:-./node}
|
|
|
|
|
|
|
|
$node benchmark/http_simple.js &
|
|
|
|
npid=$!
|
2012-12-20 00:27:21 +01:00
|
|
|
|
2012-03-07 03:19:11 +01:00
|
|
|
sleep 1
|
2012-04-10 23:59:21 +02:00
|
|
|
|
2012-12-19 18:19:06 +01:00
|
|
|
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
|