httpbench
$Revision: 1292 $
httpbench [OPTIONS] <URL>
-i IP, --ip IP
override name resolving and force IP.
-c RUNS, --concurrency RUNS
run RUNS concurrent requests.
-n REQS, --requests REQS
run a total of REQS requests.
-a, --average
print averages.
--csv
print results as csv:
start time as unix timestamp
time to complete tcp or ssl connection
time until request is sent
time to first byte received
time to connection closed
bytes received
transfer rate in KiB/s
This script measures the connection time, the time until the request was sent, the time to first byte (ttfb) and the total time of a given url.
The url can be specified as
http://host.example
https://host.example/my/document.html
http://host.example:8080
https://host.example:8443/my/document.html
...
$ httpbench.pl -c 5 -n 10 --csv --average https://www.unixadm.org
1448548167.4661;0.0507900714874268;0.0515570640563965;0.0911219120025635;0.179260969161987;15654;173.443078104966
1448548167.47803;0.0508708953857422;0.0519828796386719;0.0966849327087402;0.194674015045166;15654;156.008292051504
1448548167.48996;0.0524499416351318;0.0536410808563232;0.103994131088257;0.275166988372803;15654;89.3080224137859
1448548167.50172;0.0565109252929688;0.0577800273895264;0.0931949615478516;0.196615934371948;15654;147.814403186876
1448548167.51335;0.0735201835632324;0.0746281147003174;0.107993125915527;0.214739084243774;15654;143.210193757329
1448548167.52723;0.0539360046386719;0.0561509132385254;0.0890860557556152;0.256559133529663;15654;91.2809961946549
1448548167.53989;0.0925688743591309;0.0937228202819824;0.123549938201904;0.282636880874634;15654;96.0927975493774
1448548167.55141;0.0632588863372803;0.0643789768218994;0.100144863128662;0.234739780426025;15654;113.578652760162
1448548167.56664;0.0597851276397705;0.0608611106872559;0.0897171497344971;0.259582996368408;15654;89.9951913697298
1448548167.58238;0.0514988899230957;0.0525739192962646;0.0860049724578857;0.221637964248657;15654;112.709372352281
1448548167.52167;0.0605189800262451;0.0617276906967163;0.0981492042541504;0.231561374664307;15654;121.344099974067;avg
since httpbench is able to return its results csv-like, it's easy to process the data using gnuplot.
#!/bin/sh
site=${1:-localhost}
exec > ${site}.csv 2> ${site}.err
while true; do
httpbench.pl https://${site}/ -n 100 -c 10 -a --csv | grep 'avg$'
sleep 300
done
set terminal png truecolor size 1200 font "/usr/share/fonts/truetype/freefont/FreeMono.ttf, 8"
set output "httpbench.png"
set style data boxes
set boxwidth .66 relative
set style fill solid 1.0 border -1
set xlabel "timeline (utc)"
set timefmt "%s"
set format x "%d.%m %H:%M:%S"
set xdata time
set ylabel "s"
set yrange [0:0.1]
set y2tics
set y2label "KB/s"
set y2range [0:*]
set grid front
set datafile separator ";"
set multiplot layout 2, 1 title "httpbench graph" font ",14"
set tmargin 2
set title "site A"
plot "siteA.csv" u 1:5 ti "total", "" u 1:4 ti "ttfb", "" u 1:3 ti "pretrans", "" u 1:2 ti "connect", "" u 1:6 with lines lt rgb "red" ti "throughput" axes x1y2
set title "site B"
plot "siteB.csv" u 1:5 ti "total", "" u 1:4 ti "ttfb", "" u 1:3 ti "pretrans", "" u 1:2 ti "connect", "" u 1:6 with lines lt rgb "red" ti "throughput" axes x1y2
unset multiplot