Benchmarking Wordpress with Apache Bench
A lot of people talk about Wordpress performance, and how to get a webserver to perform as efficiently as possible. However, without a quantifiable methodology to testing website performance, you can’t actually talk about it. ApacheBench (ab) is the solution to the problem of measuring website performance. What is ApacheBench? The man page provides a suitable answer:
ab - Apache HTTP server benchmarking tool
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.
If you have installed apache or apache-devel, you should be to simple invoke ab by typing it on the command line. For example, to benchmark my own site here, I would write:
[root ~]# ab -n 10000 -c 100 http://elliottback.com/wp/
This says “make 10,000 concurrent requests to host elliottback.com via http and request /wp/ on 100 threads.” The result of this is the following report:
This is ApacheBench, Version 2.0.40-dev < $Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/Benchmarking elliottback.com (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests
Finished 10000 requestsServer Software: Apache/2.2.6
Server Hostname: elliottback.com
Server Port: 80Document Path: /wp/
Document Length: 34331 bytesConcurrency Level: 100
Time taken for tests: 13.596345 seconds
Complete requests: 10000
Failed requests: 0
Write errors: 0
Total transferred: 346230000 bytes
HTML transferred: 343310000 bytes
Requests per second: 735.49 [#/sec] (mean)
Time per request: 135.963 [ms] (mean)
Time per request: 1.360 [ms] (mean, across all concurrent requests)
Transfer rate: 24868.08 [Kbytes/sec] receivedConnection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 1.6 0 20
Processing: 8 134 12.7 132 190
Waiting: 4 134 12.7 132 190
Total: 16 134 12.1 132 190Percentage of the requests served within a certain time (ms)
50% 132
66% 134
75% 136
80% 137
90% 145
95% 160
98% 175
99% 179
100% 190 (longest request)
According to these numbers, my dual core server can do 750 requests per second, fulfilling each within about 150ms each. That’s pretty fast, probably because I know the secrets of Wordpress Optimization. If you make every layer as fast as it can be, and cache heavily, you too can see lightening fast Wordpress installations!
This entry was posted on Monday, January 14th, 2008 at 5:38 pm and is tagged with zeus technology ltd, adam twiss, apache http server, apache software foundation, apache installation, concurrency level, document length, concurrent requests, suitable answer, server hostname, document path, apache 2, server port, man page, server software, benchmark, wordpress, wp, bench, methodology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback.


on January 30th, 2008 at 9:37 am
Nice write-up.
Just a question: do you really need to set these numbers so high? Can’t I get a decent result with 100 requests in 3 threads?
Also, I hear ‘ab’ does not use reverse proxies and thus does not show the actual performance a webserver can generate?
on February 22nd, 2008 at 8:14 pm
I’ve followed most of your suggestions, but for some reason I can’t get more than 13-14req/sec out of my server and I’m at a loss as to while.
Some people have suggested it’d because I utilize PLESK as my management console, I know it’s not.
I’m on a Celeron 2.0Ghz w/ 1G memory - plenty fast enough to handle 250-300 requests/sec.
As proof, I ran ‘ab’ against apc.php (apc profiler) and it handled about 300 req/sec.
Against my wordpress install, it stuck at around 12-14/sec AND.. it shows “HTML transfered: 1 Bytes”
For some reason, ab isn’t actually hitting the site. Weird, no? Any thoughts?
on July 9th, 2008 at 12:39 pm
Do you know how to perform a test that would involve cookies (i.e. wordpress login)?
on July 9th, 2008 at 6:56 pm
Yeah. if you figure out the key/value pair for the WP login cookie, just specify as a param “-C cookie-name=value” for each one.