Apache served static pages 400 times faster than dynamic WordPress pages. Could caching bring this speed advantage to WordPress?
I measured pages with Apache benchmark tool “ab”, using 10 simultaneous connections. I used a powerful desktop as a server on localhost. I only considered the count of pages served per second.
Static pages were the fastest, with 2600 – 3700 pages served per second. All static pages got similar scores, with longer pages being slightly slower.
PHP “Hello world” was only slightly slower, 2500 pages per second.
Reading a couple of records from database was about 50% slower, 1500 pages per second.
WordPress was the slowest one, with major difference in speed. It only served 6 – 9 pages per second. WordPress was tested with default setup, without installing any caching plugins.
Apache can serve 400 times more static pages (per second) compared to WordPress. This is 40 000 % (forty thousand percent).
Could WordPress be 400 Times Faster?
Many users just read the same frontpage. If it would be static, would that mean 400 times more pages served per second?
If so, would caching achieve this? There are modules for WordPress that cache pages as static HTML.
I used a home made static caching system in the previous incarnation of my homepage, and it seemed to work well.
Sources of Errors
Test was done on a powerful desktop machine with multicore CPU and lots of RAM. Servers are often low-end virtual machines with limited RAM.
I used a machine that had been a test machine for a while. It could have misconfigurations in MySQL, Apache or PHP.
Test was done with localhost address. In practical use, network might become a bottleneck, negating some of the advantage of serving static pages.
Only number of pages served per second was considered. There are many other ways to measure speed, such as time to load HTML, time to onLoad(), latency etc.
Obviously, the measurements don’t mean that static pages are better – they are just faster to serve. WordPress was used as an example of complex dynamic application, and it was not compared to any other CMS.