1
0
Fork 0

add WIP state

This commit is contained in:
Oliver Ladner 2024-02-19 13:45:34 +01:00
commit 0b339c47a2
4 changed files with 61 additions and 0 deletions

10
README.md Normal file
View file

@ -0,0 +1,10 @@
# ab (apache bench) and Gnuplot
Two scripts:
* `ab.sh` runs your ab benchmark. Specifiy requests, concurrency and URL
* `plot_ttime.sh` generates graphs with Gnuplot (total time)
* `plot_ttfb.sh` generates graphs with Gnuplot (Time To First Byte)
Web links:
* [Apache Bench and Gnuplot: youre probably doing it wrong](http://www.bradlanders.com/2013/04/15/apache-bench-and-gnuplot-youre-probably-doing-it-wrong/)

9
ab.sh Executable file
View file

@ -0,0 +1,9 @@
#!/usr/bin/env bash
reqs=100000
concurrency=10
url='https://example.org'
fileprefix='example_org'
useragent="Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1 apachebench"
# apache bench with basic authentication
ab -A username:password -H "User-Agent: $useragent" -n $reqs -c $concurrency -g ${fileprefix}_$(date +%F_%H%M%S)_r-${reqs}_c-${concurrency}.gnuplot $url > ${fileprefix}_$(date +%F_%H%M%S)_r-${reqs}_c-${concurrency}.log

21
plot_ttfb.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
for file in $(ls -1 example*\.gnuplot); do
gnuplot <<- EOF
set terminal png size 1280,500
set size 1, 1
set output "$file\_ttfb.png"
set title "$file"
set key left top
set grid y
set xdata time
set timefmt "%s"
set format x "%H:%M:%S"
set xlabel 'time'
set ylabel "response time (ms)"
set yrange [0:10000]
set datafile separator '\t'
plot "$file" every ::2 using 2:6 title 'response time (TTFB)' with points
exit
EOF
done

21
plot_ttime.sh Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
for file in $(ls -1 example*\.gnuplot); do
gnuplot <<- EOF
set terminal png size 1280,500
set size 1, 1
set output "$file\_ttime.png"
set title "$file"
set key left top
set grid y
set xdata time
set timefmt "%s"
set format x "%H:%M:%S"
set xlabel 'time'
set ylabel "response time (ms)"
set yrange [0:10000]
set datafile separator '\t'
plot "$file" every ::2 using 2:5 title 'response time (total)' with points
exit
EOF
done