Difference between revisions of "Benchmarking and Load Testing with Apache Bench(AB)"

From Brian Nelson Ramblings
Jump to: navigation, search
(Created page with "==Benchmarking and Load Testing with Apache Bench(AB)== ApacheBench (ab) is a very handy webserver benchmarking tool which can be run from command line. It is extremely simpl...")
 
(Using AB Testing on Centos)
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
  
 
===Using AB Testing on Centos===
 
===Using AB Testing on Centos===
 
One thing to not, you should never run ab on your localhost against your localhost.
 
  
 
Let run our first test,
 
Let run our first test,
  
  ab -n 10000 -c 1000 http://www.briansnelson.com/Main_Page
+
  ab -n 100 -c 10 http://www.briansnelson.com/Main_Page
+
 
 
  This is ApacheBench, Version 2.3 <$Revision: 655654 $>
 
  This is ApacheBench, Version 2.3 <$Revision: 655654 $>
 
  Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
 
  Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
 
  Licensed to The Apache Software Foundation, http://www.apache.org/
 
  Licensed to The Apache Software Foundation, http://www.apache.org/
 
   
 
   
  Benchmarking www.briansnelson.com (be patient)
+
  Benchmarking www.briansnelson.com (be patient).....done
Completed 1000 requests
+
 
Completed 2000 requests
+
Completed 3000 requests
+
Completed 4000 requests
+
Completed 5000 requests
+
Completed 6000 requests
+
Completed 7000 requests
+
Completed 8000 requests
+
Completed 9000 requests
+
Completed 10000 requests
+
Finished 10000 requests
+
+
 
  Server Software:        Apache
 
  Server Software:        Apache
 
  Server Hostname:        www.briansnelson.com
 
  Server Hostname:        www.briansnelson.com
  Server Port:            80
+
  Server Port:            80  
 
   
 
   
 
  Document Path:          /Main_Page
 
  Document Path:          /Main_Page
  Document Length:        30431 bytes
+
  Document Length:        30431 bytes  
 
   
 
   
  Concurrency Level:      1000
+
  Concurrency Level:      10
  Time taken for tests:  67.478 seconds
+
  Time taken for tests:  0.433 seconds
  Complete requests:      10000
+
  Complete requests:      100
  Failed requests:        326
+
  Failed requests:        0
    (Connect: 0, Receive: 0, Length: 326, Exceptions: 0)
+
 
  Write errors:          0
 
  Write errors:          0
  Total transferred:      298394530 bytes
+
  Total transferred:      3084500 bytes
  HTML transferred:      294389494 bytes
+
  HTML transferred:      3043100 bytes
  Requests per second:    148.20 [#/sec] (mean)
+
  Requests per second:    231.15 [#/sec] (mean)
  Time per request:      6747.792 [ms] (mean)
+
  Time per request:      43.262 [ms] (mean)
  Time per request:      6.748 [ms] (mean, across all concurrent requests)
+
  Time per request:      4.326 [ms] (mean, across all concurrent requests)
  Transfer rate:          4318.46 [Kbytes/sec] received
+
  Transfer rate:          6962.71 [Kbytes/sec] received  
 
   
 
   
 
  Connection Times (ms)
 
  Connection Times (ms)
 
               min  mean[+/-sd] median  max
 
               min  mean[+/-sd] median  max
  Connect:        9 783 2342.6    14  15051
+
  Connect:        9   9  0.4      9      11
  Processing:    30 2046 3418.0   1144   67429
+
  Processing:    28   32   2.7    31      53
  Waiting:        0  354 801.7     23  14063
+
  Waiting:        9  10  1.3     10      16
  Total:        41 2829 4583.3  1624  67473
+
  Total:        39  41   2.8    40      61
+
 
Percentage of the requests served within a certain time (ms)
+
Percentage of the requests served within a certain time (ms)
  50%  1624
+
  50%     40
  66%   2455
+
   66%     41
  75%   3168
+
  75%     41
  80%   3599
+
  80%     42
  90%   5931
+
  90%     44
  95%   9875
+
  95%     46
  98% 17350
+
  98%     49
  99% 23289
+
  99%     61
  100% 67473 (longest request)
+
100%     61 (longest request)
  
 
Lets break down the request we used with the ab command
 
Lets break down the request we used with the ab command

Latest revision as of 14:45, 31 May 2014

Benchmarking and Load Testing with Apache Bench(AB)

ApacheBench (ab) is a very handy webserver benchmarking tool which can be run from command line. It is extremely simple to use. A quick outcome can be obtained in just one minute. It does not require too much much familiarity with load and performance testing concepts. No complex setup is required. It gets installed automatically with apache. It does not have all the features of more popular tools, but it is good for a start.

Using AB Testing on Centos

Let run our first test,

ab -n 100 -c 10 http://www.briansnelson.com/Main_Page
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.briansnelson.com (be patient).....done
 
Server Software:        Apache
Server Hostname:        www.briansnelson.com
Server Port:            80 

Document Path:          /Main_Page
Document Length:        30431 bytes 

Concurrency Level:      10
Time taken for tests:   0.433 seconds
Complete requests:      100
Failed requests:        0
Write errors:           0
Total transferred:      3084500 bytes
HTML transferred:       3043100 bytes
Requests per second:    231.15 [#/sec] (mean)
Time per request:       43.262 [ms] (mean)
Time per request:       4.326 [ms] (mean, across all concurrent requests)
Transfer rate:          6962.71 [Kbytes/sec] received 

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        9    9   0.4      9      11
Processing:    28   32   2.7     31      53
Waiting:        9   10   1.3     10      16
Total:         39   41   2.8     40      61

Percentage of the requests served within a certain time (ms)

 50%     40
 66%     41
 75%     41
 80%     42
 90%     44
 95%     46
 98%     49
 99%     61
100%     61 (longest request)

Lets break down the request we used with the ab command

  • -n is the total number of request to make
  • -c is the number of concurrent connections to make
  • and last is the domain name/url you wish to test on