Using ApacheBench to load-test a Web Server

Once you have your web site up and running, you may be curious to find out how much it can handle before it falls on its knees. If you’re a Linux user, you can make use of ApacheBench, which can be installed with sudo apt-get install ab.

Once installed, there are many complex ways you can test out your server, but I will keep things brief and show you what you need to do to get an idea of how many requests per second it can handle:

ab -n 500 -c 100 http://yoursite/

Each parameter can be adjusted to simulate different scenarios:

-n is the total number of requests that will be made
-c is the number of concurrent requests that will be sent at a time

Using man ab you can investigate all the other parameters that can be adjusted. The most important results you want to be looking for is the number of requests per second and the time per request. Also make sure that you’re not failing any requests (though that will inevitably happen when you ask too much from the server 😉 ). My NUC was able to do 1400 requests per second to the main page (through an ethernet cable, the WiFi got saturated!), with an access time of 169.8ms.

If you try -n 100 -c 1, this will show you the fastest that the server can respond in terms of latency. I got 3.5ms through an ethernet cable, and 30ms over WiFi.

Bonus clip: what logstalgia looks like in this test:

logstalgia output

NUC 5GHz WiFI Update!
BIOS Update for Intel NUC DN2820FYKH: Headless booting fixed!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.