How to use Apache Bench for Load and Performance Testing?


Apache Bench is a load testing and benchmarking tool that all WEB developers should have in their “Toolbox”.

It is designed to be used together with Apache’s web server but can be used on any other web server.

With it, we can simulate load tests to improve the performance of our applications. In it, we determine how many requests we want and how many of them can be made simultaneously.

How to install Apache Bench for load and performance testing?

In this article, we will demonstrate how we will use it in Windows, but it can be easily installed on Linux, including is recommended.

The good news is that we don’t need to install on Windows, just download and extract it into a folder from your computer.

Below is the link to the download.

Apache VC15 binaries and modules download

For (business) webmasters, developers, and home users who want running always up to date Windows VC15 binaries and

www.apachelounge.com

The folder structure will look like the figure below

The ab is in the \bin folder, as below.

Apache Bench Tutorial - Tutorialspoint

How to use it?

Use the terminal to use ab.

In the terminal, we will use the following command ab -n 100 -c 10

  • -n 100 = Represents the number of requisitions, in this case, 100 requisitions.
  • -c 10 = Represents the number of competitors, i.e. simultaneous requests
  • Then the URL that will test, remember to put the / at the end of the URL, only so the ab will understand as a valid URL. An important tip: use exactly the URL you want to test as ab doesn’t understand redirects and displays an error in the final results.

Hence, you can see how easy it is to use Apache Bench for load and performance testing.