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.
For (business) webmasters, developers, and home users who want running always up to date Windows VC15 binaries and
The folder structure will look like the figure below
The ab is in the \bin folder, as below.
How to use it?
Let’s 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 uses exactly the URL you want to test, ab doesn’t understand redirects and displays an error in the final results.
we climbed a site using ASP.NET Core to use as an example.
When running the ab we got the following result.
The example above is the basics that ab can do, but super useful for everyday web development.
Below is the complete list of ab commands
Pretty simple to use AB, right?
How to develop more performative systems with the help of Apache Bench?
See you next time.