summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-12-19 15:27:21 -0800
committerisaacs <i@izs.me>2012-12-21 00:07:35 +0000
commitec7455558f690fa5afb4e9f762a77ddaa51212f7 (patch)
tree06cec695458849fcdb740401c23c8babd545b651
parent825af451fbd5216ee44ecdf5f9f68244743b2e6b (diff)
downloadnode-ec7455558f690fa5afb4e9f762a77ddaa51212f7.tar.gz
benchmark: Set ephemeral ports properly on sunos
-rw-r--r--benchmark/http-flamegraph.sh12
-rwxr-xr-xbenchmark/http.sh19
2 files changed, 26 insertions, 5 deletions
diff --git a/benchmark/http-flamegraph.sh b/benchmark/http-flamegraph.sh
index 41aa5046f..b5b69129b 100644
--- a/benchmark/http-flamegraph.sh
+++ b/benchmark/http-flamegraph.sh
@@ -6,12 +6,20 @@ node=${NODE:-./node}
name=${NAME:-stacks}
if type sysctl &>/dev/null; then
+ # darwin and linux
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
-ulimit -n 100000
+ulimit -n 100000
$node benchmark/http_simple.js &
nodepid=$!
echo "node pid = $nodepid"
@@ -45,7 +53,7 @@ test () {
echo 'Keep going until dtrace stops listening...'
while pargs $dtracepid &>/dev/null; do
- test 100 bytes 1 -k
+ test 100 bytes ${LENGTH:-1} -k
done
kill $nodepid
diff --git a/benchmark/http.sh b/benchmark/http.sh
index b5c5388ad..c83d9e99c 100755
--- a/benchmark/http.sh
+++ b/benchmark/http.sh
@@ -1,8 +1,20 @@
#!/bin/bash
cd "$(dirname "$(dirname $0)")"
-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
+
+if type sysctl &>/dev/null; then
+ # darwin and linux
+ 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
+
ulimit -n 100000
k=${KEEPALIVE}
@@ -15,6 +27,7 @@ node=${NODE:-./node}
$node benchmark/http_simple.js &
npid=$!
+
sleep 1
if [ "$k" = "-k" ]; then