Confused About Caching my Wordpress Site

I am trying to make my wordpress site faster.

Why ?

Because ... I want to work on optimization, this is purely premature optimization on my part, but this is a side I wanted to investigate for a long time now, so I read about it, and will attempt to write down my findings, which might go out as a series of questions as there are lots of aspects which are still not clear to me.

Actually, my site isn't even built now which might affect my conclusions, as I won't be able to test the differences between the caching systems, and my motivation is lower as I don't have a real advantage in caching ... yet.

The reason I am delving into this subject is just to understand the concepts and as times come where my site will be popular and a way to optimize it will really be needed, I will have some caching infrastructure already in place for the future caching optimizations.

For example, if I understand that NginX is a faster web server than apache, then I might as well begin the site with NginX, so I won't need to change my infra structure later on.

So without further ado

From the web server perspective, it seems that Nginx is faster than the apache web server, this is a fundamental change, which I think to adopt.

PHP7 instead of previous versions is also a real time saver as it works twice as fast as previous versions, this seems like a good thing to implement from the beginning as if I will change it later on when the site is already web established, I might encounter plugins which don't work with php7, and I prefer to look at these things early on, so compatibility issues won't even start, and even if they will appear they won't affect many users.

I won't change php7 for HHVM as the performance gain isn't significant enough, and the compatibility issues are much harder to solve than with php7.

Changing the wordpress DB with a MariyaDB also seems like something I should adopt early on as the MariyaDB should be fully compatible with any plugin with need of the mysql db, and the performance gain should be nice, speaking of the DB, I should change the db table engine to xtraDB.

I should consider changing the comment system with disqus, this will gain in performance as the caching system won't need to render the php for every new comment as they will come from a 3rd party place - this one should be further investigated.

Ok, I can't avoid the caching systems anymore, so here I come

There is server caching, and there is wordpress caching.
The actual caching is split between several different types of caching: object caching, db caching, static page caching, php rendering caching and others.

I will begin with the easier side - the wordpress side - in order to enable caching in wordpress I will use a caching plugin, as there are many wordpress caching plugins, I will narrow it down to two main options which seem the best caching options for wordpress when searching the web:
  • Super cache - Created by a guy from "Automatic" - this cache plugin is super simple, install and forget and it will do the rest for you, it seems that it only caches the static data and doesn't do any other work from the other caching perspectives (should be installed with autooptimize?).
  • W3 Total Cache - Sophisticated cache which includes many caching types.
Both of the above seem to have close results (which makes me wonder, as the w3 total cache has many caching options so why isn't it much faster than the super cache).
Both are free and highly maintained.

The above should be better inspected to see if super cache + another plugin for minification (autooptimize?) + another plugin for DB caching gains much better results or if it is the same as the w3 total cache in which case I should probably cast my vote for the one plugin which does it all, unless I go for server side caching for some of the above cachings which move me to the next point.

I just don't get it, if I have the means to do server side caching, and have means to do the same functionality using wordpress plugins, what does it mean ?
Are they the same ?
Is one better than the other ?

From my simple side of view it seems that wordpress plugins are simple to manage - all from the same dashboard, and do not include a full additional component which adds lots of complexity.
On the other side, server side caching sounds as if it is much more powerful (is it?), and gets you to install a component which applies to all of your sites, which means that if you have several sites on the same server and you add a server side caching, then all sites gain the caching advantage and you don't need to install the same caching plugin on all of the sites.

And there is CDN, which is offloading the content of the site to the external content delivery system, but what does it mean regarding caching ?
If I now serve my site from a different location from servers which are not mine, is there any use to cache my site at all ? - the only one accessing it will be the CDN, so why should it be cached ?

So I will boil down my question to this:
  • Caching is good
  • Caching can come in many forms, php cache, db cache, page cache, object cache etc
  • Caching can be done in the client as a wordpress plugin
  • Caching can be done on the server side by installing caching components
  • Caching can be done on the CDN
  • So what should be cached, and where is best to cache it !? 


Popular posts from this blog

Profiling Java @ 2019

Ant Explorer graphical Ant build tool

Shared/Pro/Managed Hosting for your site - which to choose ? (NO AFFILIATE LINKS!)