Created
August 9, 2011 21:06
-
-
Save emersonmoretto/1135197 to your computer and use it in GitHub Desktop.
Apache bench + Gnuplot Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo -e "\nbenchmark.sh -n<number of requests> -c<number of concurrency> <URL1> <URL2> ..." | |
echo -e "\nEx: benchmark.sh -n100 -c10 http://www.google.com/ http://www.bing.com/ \n" | |
## Gnuplot settings | |
echo "set terminal png | |
set output 'benchmark_${1}_${2}.png' | |
set title 'Benchmark: ${1} ${2}' | |
set size 1,1 | |
set grid y | |
set xlabel 'request' | |
set ylabel 'response time (ms)' " > /tmp/plotme | |
## Loop over parameters | |
c=1 | |
for var in "$@" | |
do | |
## skipping first parameters (concurrency and requests) | |
if [ $c -gt 2 ] | |
then | |
## apache-bench | |
ab $1 $2 -g "gnuplot_${c}.out" "${var}" | |
## if for concat stuff | |
if [ $c -gt 3 ] | |
then | |
echo -e ", 'gnuplot_${c}.out' using 9 smooth sbezier with lines title '${var}' \\" >> /tmp/plotme | |
else | |
echo -e "plot 'gnuplot_${c}.out' using 9 smooth sbezier with lines title '${var}' \\" >> /tmp/plotme | |
fi | |
fi | |
let c++ | |
done | |
## plotting | |
gnuplot /tmp/plotme | |
echo -e "\n Success! Result image is: benchmark_${1}_${2}.png" | |
## show the image | |
eog benchmark_${1}_${2}.png > /dev/null & |
@emersonmoretto Thanks a lot man !
This script is ordering events by response times instead of time
-> this is one is working better for me: https://gist.github.com/garethrees/7356890
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
People who use this script might want to read:
http://www.bradlanders.com/2013/04/15/apache-bench-and-gnuplot-youre-probably-doing-it-wrong/