Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 74 lines (60 sloc) 1.7 KB
#!/bin/sh
set -e
#set -x
ab="/usr/sbin/ab"
if [ ! -x "$ab" ]; then
echo "$ab is needed"
exit 1
fi
testapp="./TestApp"
app=$1
dancer=$2
perllib=""
if [ -n "$dancer" ]; then
perllib="-I$dancer/lib"
fi
case "$app" in
"dancer.hello")
echo "Benchmarking perl $perllib $testapp/hello.pl..."
cd $testapp && perl $perllib hello.pl --environment production >/dev/null 2>&1 &
sleep 2
$ab -n 1000 http://localhost:3000/ 2>&1 | grep 'Requests'
pid=$(ps fax | grep perl | grep hello.pl | awk '{print $1}')
kill $pid
;;
"psgi.hello")
echo "Benchmarking plackup -a hello.psgi..."
cd $testapp && plackup -a hello.psgi >/dev/null 2>&1 &
sleep 2
$ab -n 1000 http://0:5000/ 2>&1 |grep 'Requests'
pid=$(ps fax | grep plackup | grep hello.psgi | awk '{print $1}')
kill $pid
;;
"dancer.big")
echo "Benchmarking perl $perllib $testapp/big.pl..."
cd $testapp && perl $perllib big.pl --environment production &
sleep 2
$ab -n 1000 http://localhost:3000/z/z | grep 'Requests'
pid=$(ps fax | grep perl | grep big.pl | awk '{print $1}')
kill $pid
;;
"dancer.matcher")
echo "Benchmarking perl $perllib $testapp/matcher.pl..."
cd $testapp && perl $perllib matcher.pl --environment production &
sleep 2
$ab -n 1000 http://localhost:3000/foo/42 | grep 'Requests'
pid=$(ps fax | grep perl | grep matcher.pl | awk '{print $1}')
kill $pid
;;
"complete")
for bench in "hello" "ten" "fifty" "hundred" "big"
do
echo -n "perl $perllib $bench.pl: "
cd $testapp && perl $perllib $bench.pl --environment production >/dev/null 2>&1 &
sleep 2
$ab -n 1000 http://localhost:3000/last 2>&1 | grep 'Requests'
pid=$(ps fax | grep perl | grep "$bench" | awk '{print $1}')
kill $pid
done
;;
esac
Jump to Line
Something went wrong with that request. Please try again.