Tuesday, 29 October 2019

Read Apache Benchmark output from gnuplot


Use -g option, to convert Apache Bench output as a 'gnuplot' or TSV (Tab separate values) file. This file can easily be imported into packages like Gnuplot, IDL, Mathematica, Igor or even Excel.

Example
ab -n 5000 -c 100 -g out.data http://localhost:9191/api/v1/cached/employees
$ab -n 5000 -c 100 -g out.data http://localhost:9191/api/v1/cached/employees
This is ApacheBench, Version 2.3 <$Revision: 1826891 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 500 requests
Completed 1000 requests
Completed 1500 requests
Completed 2000 requests
Completed 2500 requests
Completed 3000 requests
Completed 3500 requests
Completed 4000 requests
Completed 4500 requests
Completed 5000 requests
Finished 5000 requests


Server Software:        
Server Hostname:        localhost
Server Port:            9191

Document Path:          /api/v1/cached/employees
Document Length:        265 bytes

Concurrency Level:      100
Time taken for tests:   3.636 seconds
Complete requests:      5000
Failed requests:        0
Total transferred:      1920000 bytes
HTML transferred:       1325000 bytes
Requests per second:    1375.16 [#/sec] (mean)
Time per request:       72.719 [ms] (mean)
Time per request:       0.727 [ms] (mean, across all concurrent requests)
Transfer rate:          515.68 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0   36  28.1     34     216
Processing:     1   36  25.4     33     217
Waiting:        0   34  24.6     31     217
Total:          7   72  43.3     71     256

Percentage of the requests served within a certain time (ms)
  50%     71
  66%     83
  75%     93
  80%    103
  90%    121
  95%    131
  98%    179
  99%    250
 100%    256 (longest request)


out.data
starttime       seconds ctime   dtime   ttime   wait
Tue Oct 29 18:36:15 2019        1572354375      0       7       7       0
Tue Oct 29 18:36:15 2019        1572354375      6       1       7       1
Tue Oct 29 18:36:15 2019        1572354375      5       3       8       1
Tue Oct 29 18:36:15 2019        1572354375      5       2       8       1
Tue Oct 29 18:36:15 2019        1572354375      6       2       8       1
Tue Oct 29 18:36:15 2019        1572354375      6       2       8       1
.........
.........
.........

You can load this data to gnuplot utility.
Install gnuplot
sudo apt-get install gnuplot
         (OR)
brew install gnuplot


Once gnuplot is installed, open terminal and execute the command ‘gnuplot’.
$gnuplot

 G N U P L O T
 Version 5.2 patchlevel 7    last modified 2019-05-29 

 Copyright (C) 1986-1993, 1998, 2004, 2007-2018
 Thomas Williams, Colin Kelley and many others

 gnuplot home:     http://www.gnuplot.info
 faq, bugs, etc:   type "help FAQ"
 immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'qt'
gnuplot>

Execute below command in gnuplot window.

plot "out.data" using 9  w l
gnuplot> plot "out.data" using 9  w l


You can see below kind of screen.


From the above image, it is clear that first 1500 requests processed in < 50 milli seconds.



Previous                                                    Next                                                    Home

No comments:

Post a Comment