Skip to content

Instantly share code, notes, and snippets.

@TrafeX
Created February 21, 2012 12:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save TrafeX/1876257 to your computer and use it in GitHub Desktop.
Save TrafeX/1876257 to your computer and use it in GitHub Desktop.
ZF benchmarks
#!/bin/bash
concurrent=5
max=81
while [ $concurrent -lt $max ]
do
ab_args='-n 2000 -c '$concurrent
folder='run-'`date +'%Y%m%d%H%M%S'`'-'$concurrent
echo -e '============\nReady for testing '$folder', '
ssh frameworks-test.local '/etc/init.d/apache2 restart'
sleep 5
echo -e 'Starting test..\n============'
mkdir $folder
ab $ab_args -g $folder/zf1.dat http://zf1.frameworks.dev/ | tee $folder/ab-zf1.log
echo -e 'Done, restarting Apache..\n============'
ssh frameworks-test.local '/etc/init.d/apache2 restart'
sleep 5
echo -e 'Starting next test..\n============'
ab $ab_args -g $folder/zf2.dat http://zf2.frameworks.dev/ | tee $folder/ab-zf2.log
cat <<PLOT > $folder/plot.p
# output as png image
set terminal png
# save file to "out.png"
set output "$folder/out.png"
# graph title
set title "ab $ab_args"
# nicer aspect ratio for image size
#set size 1,0.7
# y-axis grid
set grid y
# x-axis label
set xlabel "request"
# y-axis label
set ylabel "response time (ms)"
plot "$folder/zf1.dat" using 9 smooth sbezier with lines title "Zend Framework 1", \
"$folder/zf2.dat" using 9 smooth sbezier with lines title "Zend Framework 2"
PLOT
gnuplot $folder/plot.p
echo -e '============\nDone, files can be found in '$folder
let "concurrent*=2"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment