Apache ab and gnuplot to generate benchmark test chart

This post described a simple demo on how to use apache benchmark test to get performance test result and generate chart with gnuplot.

benchmark performance test chart

 ⓑ maxwu > ab -v  -n40 -c1 "http://jenkins.maxwu.me/"
This is ApacheBench, Version 2.3 <$Revision: 1706008 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking jenkins.maxwu.me (be patient).....done

Server Software: Microsoft-IIS/7.5
Server Hostname: jenkins.maxwu.me
Server Port: 80

Document Path: /
Document Length: 0 bytes

Concurrency Level: 1
Time taken for tests: 2.518 seconds
Complete requests: 1
Failed requests: 0
Non-2xx responses: 1
Total transferred: 268 bytes
HTML transferred: 0 bytes
Requests per second: 0.40 [#/sec] (mean)
Time per request: 2518.479 [ms] (mean)
Time per request: 2518.479 [ms] (mean, across all concurrent requests)
Transfer rate: 0.10 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 2289 2289 0.0 2289 2289
Processing: 229 229 0.0 229 229
Waiting: 229 229 0.0 229 229
Total: 2518 2518 0.0 2518 2518
 ⓑ maxwu >

The detection on Web Server type is incorrect. The data could be dumpped in gnuplot data format with -g filename.

gnuplot> set output "http_benchmark.png"
gnuplot> set xlabel "request"
gnuplot> set ylabel "ms"
gnuplot>plot "plot.dat" using 7 with lines title "ctime", \
"plot.dat" using 8 with lines title "dtime", \
"plot.dat" using 9 with lines title "ttime", \
"plot.dat" using 10 with lines title "wait"

The benchmark test chart is generated as the chart in beginning of this post.

  • ctime: Connection Time

  • dtime: Processing Time

  • ttime: Total Time

  • wait: Waiting Time

------ End ------
Max Wu wechat
微信 WeiXin