Monday, February 9, 2015

Benching marking your site responses using Apache WorkBench

Apache workbench is a dandy tool to quickly benchmark your site's responsiveness as well as detect any application level bottlenecks. Apache workbench depends on, Gnu C compiler (GCC), Apache Runtime (APR) and Apache Runtime utils (APR Utils). Typically, you want to get the latest and greatest of these packages, so we will look at downloading the latest versions and compiling them from source

If you are setting this up in a base linux instance, you may have to install gcc
  • sudo yum install -y gcc
Now we can download and install apr and apr-utils

APR 1.5.1:-

  • wget http://apache.tradebit.com/pub//apr/apr-1.5.1.tar.gz
  • tar xvfz apr-1.5.1.tar.gz
  • cd apr-1.5.1
  • ./configure
  • make
  • sudo make install
NOTE - If you have not specified --prefix for the "configure", the pkg-config director for apr-1.pc will be /usr/local/apr/lib/pkgconfig/apr-1.pc. If you have other user installed libraries in /usr/local/lib/pkgconfig/apr-1.pc, then you can link apr-1.pc as below

  • sudo ln -s /usr/local/apr/lib/pkgconfig/apr-1.pc /usr/local/lib/pkgconfig/apr-1.pc
APR-UTIL 1.5.4:-

  • wget http://apache.tradebit.com/pub//apr/apr-util-1.5.4.tar.gz
  • tar xvfz apr-util-1.5.4.tar.gz
  • cd apr-util-1.5.4
  • ./configure --with-apr=/usr/local/apr
  • make
  • sudo make install
Apache WorkBench 2.3:-
  • wget https://apachebench-standalone.googlecode.com/files/ab-standalone-0.1.tar.bz2
  • bzip2 ab-standalone-0.1.tar.bz2
  • tar xvf ab-standalone-0.1.tar
  • export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
  • make ab
Once you have made done the above configuration, you could quickly benchmark your site's responsive by running the below command:-


$ ./ab -c 100 -n 100000 -H "User-Agent:Load-Test" -k http://<your site>/<test page>.html
This is ApacheBench, Version 2.3 <$Revision$>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking <your site> (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Completed 100000 requests
Finished 100000 requests


Server Software:        Apache-Coyote/1.1
Server Hostname:        <your host name>
Server Port:            80

Document Path:          /<test page>.html
Document Length:        209 bytes

Concurrency Level:      100
Time taken for tests:   134.133 seconds
Complete requests:      100000
Failed requests:        0
Write errors:           0
Keep-Alive requests:    42518
Total transferred:      36005468 bytes
HTML transferred:       20900000 bytes
Requests per second:    745.53 [#/sec] (mean)
Time per request:       134.133 [ms] (mean)
Time per request:       1.341 [ms] (mean, across all concurrent requests)
Transfer rate:          262.14 [Kbytes/sec] received

Connection Times (ms) min  mean[+/-sd] median   max
Connect:        0    1   7.5      1    1002
Processing:    17  133  65.8    119     740
Waiting:       17  133  65.7    119     740
Total:         17  134  66.1    120    1188

Percentage of the requests served within a certain time (ms)
  50%    120
  66%    145
  75%    160
  80%    169
  90%    201
  95%    241
  98%    330
  99%    421
 100%   1188 (longest request)



No comments:

Post a Comment