Monday, April 4, 2011

Load/Stress test your Oracle HTTP Server with Apache Benchmark (AB Tool)

Most of the times you take all that time to build your server, host your application on to it and then the management comes up to ask you how many concurrent users can it support? The answer to this question is the key to how your application is goanna perform in the production when its accessed by multiple users simultaneously. How good it is to have a simulator to simulate say n number of concurrent users and you could go ahead and test your app then. IN this post I will be showing how to use the AB tool to simulate n number of concurrent users and how you would use it to load test your web server/application hosted on it.Often you need solid metrics on the performance of your web application. Benchmarking your website can provide insight into which sections of your application might need major optimizations, and helps in dealing with scalability issues.

Since Oracle Web Server uses Apache HTTP Server internally we can use the ab tool to load test it.
In our setup the B2B trading partner link was supposed to be accessed through the Oracle Web Server (OHS 11g). The management needed to test the web server in terms of number of concurrent users it could service at any given point of time. I did a bit of research to find out tools which I could use to load/stress test the Web server servicing the HTTP requests. Though there were lot many tools available for testing the Web server I zeroed in on the ab tool from Apache and the more convincing one Apache JMeter (to be discussed in later posts).
Though you can also evaluate other tools like the Oracle Load Testing Tool, Apache tools like JMeter,AB were quite simple to use and above all are free! In this post I would show you how to use the Apache AB(Apache Benchmarking ) tool to load test your web server/web application. Apache Bench, or ‘ab’, is a command line load testing utility which ships with Apache, and allows you to simulate load on a web server. In this tutorial, I’ll show you how to get started with ab

Step 1: Install Apache on local Machine (Your Laptop/Desktop from where you would be accessing your application)
  1. Download Windows Apache (httpd-2.0.64-win32-x86-no_ssl) from
  2. Intall Apache by double clicking the installer (Install Path: C:\APACHE\)
Step 2: Load test your Web Server/Application:
  1. Go to directory: C:\APACHE\Apache2\bin and Issue below Command:

In the above example, I'm sending 100 requests in total to B2B server, 20 concurrently:

As you can see, there are various things returned, including latency times, document length, and most importantly how response times are distributed. A few remarks/tips apply to the usage of this tool:

Above command will have 10 concurrent users for 60 s with as many hits as possible, by default .When you don’t use the -n option, ab sets to default 50,000.

You can also use a -g option to get the output on a txt file to use for gnuplot. Sample Output below:

starttime                          seconds      ctime dtime ttime wait
Sat Apr 02 14:57:51 2011      1301736471009140  403   3649  4052  3649
Sat Apr 02 14:57:51 2011      1301736471412870  403   3246  3649  3245
Sat Apr 02 14:57:51 2011      1301736471816601  419   2826  3245  2826
Sat Apr 02 14:57:52 2011      1301736472235860  403   2423  2826  2422
Sat Apr 02 14:57:52 2011      1301736472639590  388   2034  2422  2034
Sat Apr 02 14:57:53 2011      1301736473027793  419   1615  2034  1614
Sat Apr 02 14:57:53 2011      1301736473447051  403   1211  1614  1211
Sat Apr 02 14:57:53 2011      1301736473850782  388   823   1211  822
Sat Apr 02 14:57:54 2011      1301736474238984  419   481   900   481
Sat Apr 02 14:57:54 2011      1301736474658243  403   435   838   434

 Usage: ab [options] [http[s]://]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)
    -Z ciphersuite  Specify SSL/TLS cipher suite (See openssl ciphers)
    -f protocol     Specify SSL/TLS protocol (SSL2, SSL3, TLS1, or ALL)
Repeat above command 3-5 times and save the best reading.

If you need to study more the AB tool please refer to :

For Apache HTTP Server Tuning

Other tools recommended by me:

Hope this articles help. Awaiting your comments...


  1. eToro is the best forex trading platform for beginning and professional traders.

  2. BlueHost is ultimately one of the best website hosting company for any hosting plans you might require.