Sunday, July 27, 2014

Apache Benchmark load generating tool for website testers.

Apache Benchmark is a good tool for generating load in our website. This is useful while we doing performance testing.

To Install: 

Download apache from and install. For linux you can use command "yum install httpd" .

To Run:

Go to the path where apache installed. In linux the command path will be populated automatically

Use command "ab" with required parameters.

Example : ab -n 20 -c 5 http://localhost:8080/

C:\Program Files\Apache Group\Apache2\bin>ab -n 20 -c 5 http://localhost:8080/
This is ApacheBench, Version 2.0.41-dev <$Revision: $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd,
Copyright (c) 2006 The Apache Software Foundation,
Benchmarking localhost (be patient).....done

Server Software:        Apache-Coyote/1.1
Server Hostname:        localhost
Server Port:            8080
Document Path:          /
Document Length:        11430 bytes
Concurrency Level:      5
Time taken for tests:   0.46875 seconds
Complete requests:      20
Failed requests:        0
Write errors:           0
Total transferred:      231420 bytes
HTML transferred:       228600 bytes
Requests per second:    426.67 [#/sec] (mean)
Time per request:       11.719 [ms] (mean)
Time per request:       2.344 [ms] (mean, across all concurrent requests)
Transfer rate:          4800.00 [Kbytes/sec] received
Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   3.4      0      15
Processing:     0    6   7.7      0      15
Waiting:        0    3   6.2      0      15
Total:          0    7   7.7     15      15
WARNING: The median and mean for the total time are not within a normal deviatio
        These results are probably not that reliable.
Percentage of the requests served within a certain time (ms)
  50%     15
  66%     15
  75%     15
  80%     15
  90%     15
  95%     15
  98%     15
  99%     15
 100%     15 (longest request)

To get other  parameters just run command ab.

C:\Program Files\Apache Group\Apache2\bin>ap
'ap' is not recognized as an internal or external command,
operable program or batch file.

C:\Program Files\Apache Group\Apache2\bin>ab
ab: wrong number of arguments
Usage: ab [options] [http://]hostname[:port]/path
Options are:
    -n requests     Number of requests to perform
    -c concurrency  Number of multiple requests to make
    -t timelimit    Seconds to max. wait for responses
    -p postfile     File containing data to POST
    -T content-type Content-type header for POSTing
    -v verbosity    How much troubleshooting info to print
    -w              Print out results in HTML tables
    -i              Use HEAD instead of GET
    -x attributes   String to insert as table attributes
    -y attributes   String to insert as tr attributes
    -z attributes   String to insert as td or th attributes
    -C attribute    Add cookie, eg. 'Apache=1234. (repeatable)
    -H attribute    Add Arbitrary header line, eg. 'Accept-Encoding: gzip'
                    Inserted after all normal header lines. (repeatable)
    -A attribute    Add Basic WWW Authentication, the attributes
                    are a colon separated username and password.
    -P attribute    Add Basic Proxy Authentication, the attributes
                    are a colon separated username and password.
    -X proxy:port   Proxyserver and port number to use
    -V              Print version number and exit
    -k              Use HTTP KeepAlive feature
    -d              Do not show percentiles served table.
    -S              Do not show confidence estimators and warnings.
    -g filename     Output collected data to gnuplot format file.
    -e filename     Output CSV file with percentages served
    -h              Display usage information (this message)

No comments:

Post a Comment

Which operating system you like most?