WordPress caching solutions

Lately I’ve been working on Custom blogs and Total Cache just wasn’t cutting it because the cache would be regenerated daily. What’s involved in making the cache work is compressing the data and storing it locally. Do this for thousand pages daily where pages can take up to 2 seconds to load and it really starts to add up and you will quickly find that you can no longer host your blog on a non-dedicated server.

In order to get a page working with W3 Total Cache you have to load it once first.
If it takes a long time to load the page your site may run out of system resources.
This is where you want to use a tool like Fragment Cache
It can reduce load times considerably by caching portions of
your blog that don’t change considerably from page to page.
A simple problem of loading 5000 pages * 2 seconds a page would take ~3 hours to cache. If you did this daily your users would riot!
If you reduce the time from 2 seconds to 50 ms you will be in an acceptable range of 4 minutes.
Adding fragment cache requires experience with php/html to modify pages/templates though so it’s not something you can just load on your blog like total cache.

A quote from fragment cache:

There are a lot of great caching plugins out there, but this one solves a very particular need that none of the rest are doing. It allows you to cache particular sections of your page, using a technique known as “fragment caching”, which is readily available in other frameworks such as Ruby on Rails. The key benefit here: you can cache content for logged-in users! This is the main limitation of most other caching plugins, which is where the need for this solution came about.

There are other Fragment cache solutions out there including ones built into total cache. I found this one the easiest one for me to implement and use.
Also I’ve made a few simple updates to fragment cache such as directories/folders to improve disk read performance.

Finally you need to optimize the actual queries. Usually each page has a unique query. If this query is slow it really can affect how fast you cache your data.
Adding indexes to tables, or creating temporary tables to presort data will
improve performance. Use wordpress hooks to modify and add new tables.

Finding these slow queries can be time consuming. Try using the
query monitor wordpress plugin.

Here’s my guideline for acceptable performance.

Page load times:
Slower than 1 second users will notice and you will not have many concurrent users.
1 second loading time – Not so good.
0.5 second loading time – Ok
0.1 second loading time – Better than most
0.05 second loading time – Nice!

Leave a Reply

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