Jun 14, 2015

Load Testing Apache with AB (Apache Bench)

ab - Apache HTTP server benchmarking tool

  • ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. 
  • It is designed to give you an impression of how your current Apache installation performs. 
  • This especially shows you how many requests per second your Apache installation is capable of serving.

-n => No.of requests
Number of requests to perform for the benchmarking session. The default is to just perform a single request which usually leads to non-representative benchmarking results.

-c => Concurrency
Number of multiple requests to perform at a time. Default is one request at a time.

-k => Keep Alive
Enable the HTTP KeepAlive feature, i.e., perform multiple requests within one HTTP session. Default is no KeepAlive.
KeepAlive header, which asks the web server to not shut down the connection after each request is done, but to instead keep reusing it.

-q => Supress messages
When processing more than 150 requests, ab outputs a progress count on stderr every 10% or 100 requests or so. The -q flag will suppress these messages.

 -r => Don't exit on socket receive errors.

E.g.,
 ab -n 1000 -c 100 http://test.xyz.com/

Sample Output:
Benchmarking test.xyz.com (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
Finished 1000 requests

Server Software:        Apache/2.2.15
Server Hostname:        test.xyz.com
Server Port:            80

Document Path:          /
Document Length:        29089 bytes

Concurrency Level:      450
Time taken for tests:   9.537570 seconds
Complete requests:      1000
Failed requests:        0
Write errors:           0
Total transferred:      29537664 bytes
HTML transferred:       29295116 bytes
Requests per second:    104.85 [#/sec] (mean)
Time per request:       4291.906 [ms] (mean)
Time per request:       9.538 [ms] (mean, across all concurrent requests)
Transfer rate:          3024.36 [Kbytes/sec] received


No comments:

Post a Comment