ab, is a small benchmark utility that comes with Apache. It’s a really simple HTTP load generating tool, ideal for a simple WordPress load & speed test. How fast does your WordPress site respond? How many HTTP requests per second can your server handle? These are questions on which ab can shed some light. Here is how to load test WordPress with ApacheBench.
In this post I show you how you can benchmark the loading speed of your WordPress. For this you use ab, or ApacheBench.
ab is a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server. It is designed to give you an impression of how your current Apache installation performs. This especially shows you how many requests per second your Apache installation is capable of serving. Making it a perfect tool to test your WordPress hosting.
Apache Bench, or ab, is available in apache2-utils, that you can easily install using
apt install apache2-utils on Ubuntu.
Suppose you want to see how fast your website can handle 100 requests, with a maximum of 10 requests running concurrently. For this you use Apache Bench, or
ab -n 100 -c 10 http://www.example.com/
This’ll generate the following output:
Concurrency Level: 10 Time taken for tests: 2.219 seconds Complete requests: 100 Failed requests: 0 Total transferred: 1261400 bytes HTML transferred: 1225500 bytes Requests per second: 45.07 [#/sec] (mean) Time per request: 221.897 [ms] (mean) Time per request: 22.190 [ms] (mean, across all concurrent requests) Transfer rate: 555.14 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 9 14 5.3 13 48 Processing: 157 201 47.5 189 364 Waiting: 142 186 47.4 174 353 Total: 170 215 49.2 203 383 Percentage of the requests served within a certain time (ms) 50% 203 66% 208 75% 212 80% 214 90% 261 95% 369 98% 382 99% 383 100% 383 (longest request)
As you can see, this is very useful information. The benchmarked WordPress site returned requests at 45.07 requests per second, the fastest was 170 ms, the slowest 383 ms.
Using ApacheBench, or
ab, you can easily benchmark your WordPress website with various PHP versions and configuration settings.
Benchmarking various PHP versions
Using ApacheBench, I benchmarked various PHP versions. The tested PHP versions are 5.5.30, 5.6.19 and 7.0.4, with and without Wincache, and the results are somewhat surprising, as you can see for yourself:
|PHP version||Requests per second (#/sec)||Fastest (ms)||Slowest (ms)|
|7.0.4 & Wincache||45.07||170||383|
|5.6.19 & Wincache||48.63||149||390|
|5.5.30 & Wincache||38.16||151||546|
Not only does PHP 5.5.30 handle the most requests per second, it’s even the fastest in this test.
Because of the server being a shared hosting web server, there may have been load peaks during testing interfering with the results – but not that I have noticed.