Apache Bench or ab for short, is a command-line tool to perform simple load tests on an HTTP server, be it a website or an API.
By running the following command, you will get an overview of how the server is performing under load:
ab -n 100 -c 10 <url>
So, in this post, I will try to explain how we can use Apache Bench. I will start with how to install it, then proceed on how to use it and the available options, and finally, I explain how to interpret the results.
Let’s get started!
One of the advantages of Apache Bench is that you may already have **ab**
installed, depending on the OS you are using. For macOS users, it comes pre-installed by default, and if you are using a Linux Distribution, there are a lot of chances that it is also installed as it comes with the **httpd**
package. Try to run **ab -help**
to verify if that’s the case.
In case it is not installed, you will need to install the **apache2-utils**
package. For example, if you are using **Ubuntu**
you will have to run:
apt-get update
apt-get install apache2-utils
So, now, that we have Apache Bench installed, let’s see how we can use it and some of the available options.
#apache-bench #load-testing #performance #command-line #testing