Skip to content

Instantly share code, notes, and snippets.

@hpwxf
Last active June 19, 2018 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hpwxf/76a4af37288c3d985603714ccef0d536 to your computer and use it in GitHub Desktop.
Save hpwxf/76a4af37288c3d985603714ccef0d536 to your computer and use it in GitHub Desktop.
Graphing of gnuplot data from Apache Benchmark. This plot show the % of requests completed (y-axis) before a given time (x-axis).
# Tell gnuplot to use tabs as the delimiter instead of spaces (default)
set datafile separator '\t'
# output as png image
set terminal png
# save file to "benchmark.png"
set output "benchmark.png"
# The graph title
set title "HTTP Benchmark"
# Where to place the legend/key
set key right bottom
# x-axis label
set xlabel "seconds"
set grid x
set logscale x
# y-axis label
set ylabel "% of completed requests"
set grid y
set format y '%2.0f%%'
stats "out.dat" every ::2 using 5 prefix "A"
# data must be sort according to their value (default order has a bias due to late request are obviously long)
# column 9 in sort is equivalent to 5 with a tabulated separated data
plot '<(tail -n +2 out.dat | sort -n -k 9)' every ::2 using 5:(100*$0/A_records) smooth sbezier with lines t '% of request done before time'
$ ab -n 1000 -c 10 -g out.dat http://example.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment