Getting the Best WordPress Performance

Wordpress Bechmark

In our previous PHP 7 vs HHVM benchmark, Benchmark Series 2: WordPress, we saw HHVM outperform PHP 7 by 7% on WordPress. That test was performed without any cache involvement to test pure HHVM and PHP 7 performance. But what about WordPress performance in a real world situation?

According to W3Techs’ usage report, WordPress is used by 24.3% of all the websites and holds 58.7% of the content management system market share. As the #1 content management system, we want to see how fast WordPress can be in a real world environment.

To this extent, LiteSpeed Technologies is currently developing our own WordPress cache plugin and are excited to share more information on this project as soon as it is available. In the meantime, a third party page caching solution, WP Super Cache, was used for this round of benchmarks. These benchmarks are using PHP 7, but are meant only as a WordPress benchmark.

Two cache modes in WP Super Cache were used for this test, “Use mod_rewrite to serve cache files” and “Use PHP to serve cache files”. According to their product description, “mod_rewrite” is the fastest and most recommended way to serve cache files as web servers would rather serve from static files instead of processing the heavier and more expensive WordPress PHP scripts. When using “php_mode”, caching will still be performed, but every request will require the loading of the PHP engine.

Neither WP Super Cache nor W3 Total Cache can use the default Permalink Settings, hence the URL list from the OSS Performance project has to be modified. We chose to use Numeric options which literally change the URL from http://192.168.0.61:8092/?p=123 for example, to http://192.168.0.61:8092/archives/123.

Since there are only 2 cores on our VPS test server, we turned off gzip compression for all web servers to help relieve some pressure on CPU and get a more accurate comparison. We are using LiteSpeed Web Server Enterprise for this test, however, OpenLiteSpeed has almost the same performance as our Enterprise version. This means you can replicate this benchmark on OpenLiteSpeed with similar settings and should get similar results.

Benchmark Server Configuration:
Typical VPS Server in an OpenVZ container
Running CentOS 7
2 cores of Intel(R) Xeon(R) CPU E5-1620 @ 3.60GHz
4G RAM
LiteSpeed Enterprise: 4.2.24
Apache: 2.4.6
PHP7- Version => 7.0.0-dev, Build Date => July 24 2015 – Git latest version -lsapi mod for LiteSpeed and php-fpm mod for Apache

WordPress Setup:
We use the same WordPress setup as in the OSS Performance project. OSS Performance is used to test the php performance, hence no page caching solutions. We have changed the WordPress Permalink Settings from default to Numeric and installed WP Super Cache.

Benchmarking Tools
Siege 2.78 is used for this test, just as it was for our previous WordPress benchmark. We used the following commands to simulated 10 concurrent users with 100 repetitions as well as 100 concurrent users with 1000 repetitions to simulate a higher traffic scenario:

siege278 -b -q -c 10 -r 100 -f wordpress2-cache.urls
siege278 -b -q -c 100 -r 1000 -f wordpress2-cache.urls

The WordPress url list is the same one as in the previous WordPress benchmark mentioned at the beginning of the article, with format changes to numeric style. The URL list is made up of 140 lines including long tail of posts, WP front pages, RSS feeds.

WordPress performance on LiteSpeed Web Server:
LiteSpeed+WordPress+Cache

As we can see, the use of a page cache makes a huge difference on WordPress performance. Using the siege command, we simulated 10 concurrent users with 100 repetitions and tested against WordPress without a page cache, with php_mode page cache, and with rewrite_mod page cache. With php_mode, pages are cached but still need to go through the PHP engine. This is 3000% faster than WordPress with no page cache. With rewrite_mod cache, WordPress runs 4400% faster than with no page cache.

Shall we dig a little deeper? What will happen if web traffic is higher? We again used siege to simulate 100 concurrent users with 1000 repetitions. This translates to 100,000 hits. The results were very interesting: instead of slowing down, LiteSpeed actually showed higher performance on the high traffic test with 7142.86 Requests/Sec. That is 5700% faster than WordPress with no page cache! This also further proves that LiteSpeed is the way to go when it comes to handling heavy traffic environments.

How does Apache compare? Let’s take a look.

WordPress performance on Apache Web Server:
Apache+WordPress+Cache

Without a page cache, Apache’s performance is very similarly to that of LiteSpeed. When using php_mode cache, WordPress runs 2200% faster than with no page cache. rewrite_mode runs at a similar speed to php mode, showing less of a performance gain than we initially expected. Apache’s weak ability to handle static files may account for this.

We then simulated 100 concurrent users with 1000 repetitions to again represent a higher traffic situation. WordPress performance dropped to 2594.71 Requests/Sec! In contrast LiteSpeed, as we showed earlier, saw a huge performance improvement of 7142.86 Requests/Sec. Apache’s server load for this test was 6.29 for our 2 core test VPS, while the server load for LiteSpeed when performing the same test on the same hardware was only 0.82. LiteSpeed’s ability to keep CPU load to a minimum was clearly a factor in reaching this higher performance even in a heavy traffic environment.

Conclusion:

Page cache makes huge difference on WordPress performance. Of course, PHP Opcode cache has been used for all of our benchmark tests which definitely improves PHP running time by a good deal. We also saw that in the cases of LiteSpeed and Apache, your choice of web server does make a noticeable difference in your overall WordPress performance! But what about Nginx? We will be doing more shoulder-to-shoulder comparisons between these top three popular web servers in the near future.

In our next benchmark, we will be validating whether or not HHVM is still faster than PHP 7 when WP Super Cache is being used. We think the results will be very interesting. How will WordPress performance differ between different web servers, with and without a page cache? When is choice of web server a factor? When is it not? Keep an eye out for “PHP 7 vs HHVM Benchmark Series 3: How fast can WordPress go?”.

What do you think about this test? What would you like to see next? If you have any feedback/comments/recommendations, we are keen to hear from you. Shoot us an email at info@litespeedtech.com.



Related Posts


Comments