[How-To] Performance Measure Your Website With Apache Bench
Apache Bench (ab.exe) is a benchmarking tool which can be used to load test your website,generate performance diagnostics against your site or to do other tests with regards to how your server behaves when exposed to load. Apache Bench (ab) especially shows you how many requests per second your web server is capable of serving.
If you are on windows and have Apache installed, you may already have ab.exe in your apache/bin folder. On linux look out for ab.
Some Use Case learnings when using Apache Bench for performing load testing
1.) In order to eliminate performance equation from your test results,consider running the test against the localhost, ie. you must have Apache bench installed on the same machine as your web/app server you wish to benchmark.
2.) If you wish to have some network statistics built into the test results, you can run Apache Bench from the remote machine. Running Remote machine tests are more useful when you know about the networks/geographies where you have a poor performance.The report generated by Apache Bench after having finished with the tests also contains information about the connect, processing and wait times.This can certainly help you figure out where the problem exactly is.
3.) If you have different code configuration which need to be tested for performance evaluation,Apache bench can be a very good free to use tool.With the reports generated, you can certainly conclude which code configuration performs better under same set of load conditions.
4.) Running Apache Bench against the host during different hours of the day is also a good strategy.This usually helps if you are seeing degraded performance during certain hours of the day as compared to other. The statistics can reveal if you need a new hardware or if your ISP needs a dosage from you
![]()
In order to run Apache Bench, you must have Apache installed ( as the ab.exe binary comes with Apache). At the very basic, Apache bench takes in a URL , concurrency and number of requests for which the tests need to be executed. Usage instructions for Apache Bench are mentioned below
Usage: ab [options] [http://]hostname[:port]/path
Some important and very basic options for Apache Bench are
-n requests : This option lets you define the number of requests to perform.
-c concurrency : This option controls the concurrenct requests to make.
-t timelimit : Seconds to max. wait for responses.
E.g : ab -n 100 -c 10 http://www.yahoo.com/
The above mentioned example will run a Apache bench test which will send 100 requests, with a maximum of 10 requests running concurrently.
Below is a snapshot of the results obtained after having run the tests ( click here to enlarge)

Image: Apache Bench for performance benchmarking websites.
Some points to ponder upon when doing Performance benchmark tests and reading out the results of the tests
1.) When looking at the results obtained from Apache Bench or any other performance benchmarking tools, don’t forget to pay attention to the number of failures. While connect times and processing times are important, having significant number of failures in processing the request is no good for any website/webserver.
2.) Test variety of URLs. This helps you determine the issues that might be arising because of server side includes or mirror sites etc ( if certain objects are served out of mirror site by the load balancer).
3.) Ensure that your load generation points ( installations of your load testing tools) are distributed. This helps in visualizing the results from different network and geographical conditions.
4.) With the abundance of iPhone and the blackberry and the Palm Pre and Windows Mobile in the system, its important that your tests also take into account the effect of various user-agents.
I hope the above notes on Website performance benchmarking using Apache Bench and also the use cases and the important points you need to consider when performance evaluating your website, certainly helps you get a better view about performance tests against websites. What are the other tools you use for load testing your website?
Important Note: Load tests should only be carried out against the websites you own. If you are carrying out load tests against the webservers/ websites not owned by you, ensure that you have a written permission to do with clear date and time markings. This post is only for educational purposes and the author is not responsible in any way for the acts carried out after reading the posts.
Also Read: [Web Performance] Load Test Your Website With Load Impact
[Web Performance] Google Page Speed Helps You Optimize Page Speeds
You can follow me on Twitter at http://twitter.com/vaibhav1981
Do stay tuned to Technofriends for more, one of the best ways of doing so is by subscribing to our feeds. You can subscribe to Technofriends feed by clicking here.
Related posts:
- Get your website checked at Google Site Clinic
- [Web Performance] Load Test Your Website With Load Impact
- View HTTP Request and Response Header Online Using Web-Sniffer
- [Site Uptime] Monitor your website for FREE with Montastic
- [Web Performance] Google Page Speed Helps You Optimize Page Speeds
I love using bbPress for my communities. I recommend http://www.bbpressthemes.net for cool bbPress templates.
[...] [How-To] Performance Measure Your Website With Apache Bench … [...]
Good One & Highly informative Pandey ji…
Alagesh
Really a interesting one, I have got an evidence to show the response time to my hosting company. Thanks again.
[...] Read:[How-To] Measure Performance of Your Website With Apache [...]