Let’s say you have had your site for quite some time now and it gets a good number of hits. With steady increase in traffic for your site, there is one minus, however. Once the popularity of your site crosses a certain limit, your server’s capabilities will be tested and rendering pages might become very slow. Worse still, the server might crash if there are too many requests at the same time. What could you do then to avoid such a situation?
There are various plugins that perform the task of caching in WordPress, but we would be using W3 Total Cache, arguably the best caching plugin available online.
W3 Total Cache:
W3 Total Cache is perhaps the best caching and performance optimization plugin out there for WordPress. It is trusted by sites of big players on the market like AT&T, Mashable, CSS Tricks and Web Designer Depot. The W3 Total Cache plugin for WordPress offers caching abilities are page caching, database caching, browser caching and delivery through a content delivery network (CDN).
Installing the plugin:
Head over to the official page for the plugin on the WordPress site or search for W3 Total Cache in Plugins > Add New. After installation, activate the plugin, which will add a new item ‘Performance’ on your left menu.
Configuration and Settings:
If you just click on the Performance tab on the left, you could be overwhelmed because the powerful plugin that W3 Total Cache is, there are a lot of options to customize.
In general settings, you are asked the basic things regarding all the settings provided by W3 Total Cache.
You can enable page cache, which would save static pages to render requests faster. This way of performing caching creates static pages for popular pages and renders them unless there are changes in the pages since the time they were cached. This doesn’t make requests to the database, rendering it through PHP for every page load but shows the cached copy instead.
You can enable Database caching to cache the responses of the database to SQL queries, or object caching to reduce execution time for common operations. Do note that database caching is best used when object caching is disabled.
Server Caching is a bit more complex and can be done in a variety of ways. A simplified version would be to use caching servers, also called reverse proxy servers, which act as in intermediate between the end user and the actual web server that hosts the WordPress site.
You can enable the content delivery through a CDN (Content Delivery Network). The most popular (and the one mentioned in the dashboard of this plugin) is the MaxCDN. Do note that CDN services are separate and you need to add them as a CNAME in your domain after setting them up, a process which is beyond the scope of this blog post.
After you have setup the plugin, make sure you export the settings. This would help you if your site crashes, or if you want to revert to the original state on changing something by mistake.
We hope that this post helped you in understanding the complex process of caching of a site and increase the performance of your site in the process! If you have any queries, feel free to leave a comment below.