Uncategorized WordPress

The Difference a Cache Makes

I decided to run a quick test to see just how much caching matters in a WordPress. I ran this test against a stock WordPress 3.8 install running Twenty Fourteen using Siege. I used the base nginx config from Varying Vagrant Vagrants. The site was loaded with the Theme Test Data so it had more than one post.

I did three test runs, all of them using 100 concurrent users requesting the homepage 100 times for a total of 10000 page loads.

The first test run was a completely stock WordPress install.

Transactions:		         569 hits
Availability:		       34.19 %
Elapsed time:		      499.20 secs
Data transferred:	       30.00 MB
Response time:		       27.48 secs
Transaction rate:	        1.14 trans/sec
Throughput:		        0.06 MB/sec
Concurrency:		       31.33
Successful transactions:         569
Failed transactions:	        1095
Longest transaction:	       30.01
Shortest transaction:	        0.00

As we can see, it didn’t take long for the site to fail. Only 569 requests succeeded.

Next I enabled the memcached plugin and setup memcached (with the stock VVV memcached config).

Transactions:		        1047 hits
Availability:		       49.76 %
Elapsed time:		      629.86 secs
Data transferred:	       58.56 MB
Response time:		       28.51 secs
Transaction rate:	        1.66 trans/sec
Throughput:		        0.09 MB/sec
Concurrency:		       47.40
Successful transactions:        1047
Failed transactions:	        1057
Longest transaction:	       30.07
Shortest transaction:	        1.04

Almost double the number of transactions succeeded, but we still brought the server down.

Finally, I enabled batcache as a full page cache.

Transactions:		       10000 hits
Availability:		      100.00 %
Elapsed time:		      110.76 secs
Data transferred:	      593.44 MB
Response time:		        1.10 secs
Transaction rate:	       90.29 trans/sec
Throughput:		        5.36 MB/sec
Concurrency:		       99.56
Successful transactions:       10000
Failed transactions:	           0
Longest transaction:	        3.26
Shortest transaction:	        0.54

100% Success! You will also notice that this run took less than 20% of the time as my previous attempt where only ~1/10 of the requests succeeded.

Moral of the story: WordPress + Memcached + Batcache = Win!

2 replies on “The Difference a Cache Makes”

Obviously a scenario where all page loads are of the same page is a bit contrived and a best-case scenario for full-page cache, but it does make a good point. Many people are starting to underdand that cache is important, but they often miss that not all caching systems are created equally. Finding the right caching for your site is important.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.