Thursday, January 9, 2014

Apache Benchmark with ab command

ab command comes with apache server itself is used to benchmarking to simulate a high load to gather data for analysis. We can generate graphs using gnuplot from the data we get from ab tool.

Let's do some benchmarking for our server http://www.allaboutlinux.info/index.html

root@server-82:~# ab -n 1000 -c 50 -g allaboutlinuxdata.txt http://www.allaboutlinux.info/index.html

n = no of connection ( 1000 here)
c = no of concurrent user (50 here)

This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking www.allaboutlinux.info (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
Completed 500 requests
Completed 600 requests
Completed 700 requests
Completed 800 requests
Completed 900 requests
Completed 1000 requests
Finished 1000 requests


Server Software:        GSE
Server Hostname:        www.allaboutlinux.info
Server Port:            80

Document Path:          /index.html
Document Length:        90579 bytes

Concurrency Level:      50
Time taken for tests:   1.702 seconds
Complete requests:      1000
Failed requests:        928
   (Connect: 0, Receive: 0, Length: 928, Exceptions: 0)
Write errors:           0
Non-2xx responses:      928
Total transferred:      7007408 bytes
HTML transferred:       6671096 bytes
Requests per second:    587.57 [#/sec] (mean)
Time per request:       85.097 [ms] (mean)
Time per request:       1.702 [ms] (mean, across all concurrent requests)
Transfer rate:          4020.83 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:       22   26   9.8     25     312
Processing:    26   57 119.8     29    1623
Waiting:       26   39  51.8     29     911
Total:         49   83 120.8     54    1650

Percentage of the requests served within a certain time (ms)
  50%     54
  66%     55
  75%     57
  80%     58
  90%     67
  95%    293
  98%    521
  99%    630
 100%   1650 (longest request)


Now we are going to generate graphs based on the data using gnuplot

root@server-82:~# gnuplot

        G N U P L O T
        Version 4.4 patchlevel 3
        last modified March 2011
        System: Linux 3.2.0-29-generic

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

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help seeking-assistance"
        immediate help:   type "help"
        plot window:      hit 'h'

Terminal type set to 'wxt'
gnuplot> set terminal png
Terminal type set to 'png'
Could not find/open font when opening font "/usr/share/fonts/truetype/ttf-liberation/LiberationSans                                                                     -Regular.ttf", using internal non-scalable font
Options are 'nocrop medium size 640,480 '
gnuplot>  set output "ABRallaboutlinux.png"
gnuplot>  set title "Apache Benchmark for Allaboutlinux.info"
gnuplot> set xlabel 'request'
gnuplot>  set ylabel 'ms'
gnuplot> plot "allaboutlinuxdata.txt" using 10 with lines title 'Benchmark from allaboutlinux'
gnuplot>
gnuplot>
gnuplot>
gnuplot>


And here is the graphs


No comments :

Post a Comment