WordPress load testing with ApacheBench.
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.
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.
As you can see, 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.
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.
Caveat: 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.
Note: this is an older post, moved from another blog of mine.
My name is Jan. I am not a hacker, coder, developer, programmer or guru. I am merely a system administrator, doing my daily thing at Vevida in the Netherlands. With over 15 years of experience, my specialties include Windows Server, IIS, Linux (CentOS, Debian), security, PHP, WordPress, websites & optimization. Want to support me and donate? Use this link: https://paypal.me/jreilink.
Automatically flush Redis cache after publishing a WordPress post
WordPress .htaccess security best practices in Apache 2.4.6+
Set WP_MEMORY_LIMIT value correctly in wp-config.php
How to: Protect WordPress from brute-force XML-RPC attacks
Remove Jetpack email sharing service
How to make Twenty Seventeen theme full width in WordPress
Check WordPress Core files integrity
Clear PHP opcode caches before WordPress Updates: ease the updating process