WordPress is known for its versatility, functionality and flexibility, but for example when it comes to being able to use it as a backend for sites that receive more than a 100,000 visitors every month, you have to start thinking about factors such as performance of the server and the WordPress installation, and how that reflects the overall user experience in terms of browsing speed, availability, and general smoothness of browsing.
You can find this on every major WordPress hosting provider out there, the notice that as your site grows, so should your resources to be able to keep up with the demand. Sometimes it's a hard lesson to learn, when the site host disables your account for using too much resources, and sometimes you have to spend a day or two trying to fix things yourself because you didn't know this would become an issue in the first place.
Luckily, there's a thing called Caching
In computing, active data is often cached to shorten data access times, reduce latency and improve input/output (I/O). Because almost all application workload is dependent upon I/O operations, caching is used to improve application performance. //TT
And we have already shared a tutorial about how to increase website performance and a great roundup post with the most popular WordPress cache plugins out there, so this post is not going to be about cache plugins per-say, but about common issues and dead-ends that you may run into when using a caching plugin and/or a caching system.
Cache Doesn't Clear
This is very likely the most common WordPress caching problem you're going to encounter, or in fact have encountered already. You create new posts, you use the custom “Clear Cache” buttons on your plugin, but nothing is happening? Well, in most cases, these are the reasons:
- Your www-data does not have enough permission to modify files.
- Your cache folder's permissions deny the manipulation of files.
- Your browser is still serving a cached version of the site (clear browser cache).
The first two are actually pretty much the same thing. In first case scenario, you want to check that your www-data account that runs the Apache/nginx installation on your server has enough permissions to edit/modify files (if you don't own a private server, you will have to reach out to your hosting provider to check for you), and if it doesn't you need to change that.
sudo chown -R www-data:www-data /var/www sudo chmod -R 770 /var/www
You can execute the above code on your websites server, which will then grant read and write permissions of your home directory for the user www-data. In most cases, this does solve the problem permanently, and you should be able to clear cache without any issues. The second most common case is that, the web user does have the permission to work within the home directory, but the actual cache folder is locked out, so you would need to change the permissions.
First you need to find out the location of your cache folder, which is going to be unique for each plugin. After you've got that, you can change the permissions with the following command:
chmod 755 /var/www/cache
At this point, if you're still running into any problems, you should contact directly with your host to find out what's going on. In general, this is one of the major issues that WordPress webmasters encounter when dealing with caching plugins.
It's worthy of mentioning that a WordPress plugin might not be the best caching solution out there, there are two other very popular techniques for caching your WordPress website, which can prove to be much better at caching, and provide much more seamless experience to your readers. Here's a quick intro for both of them.
Varnish Cashing Server
Varnish requires a little bit of technical information about Linux and the general installation process on this platform, but by following a concise tutorial – you shouldn't encounter any problems along the way. What exactly is Varnish?
Varnish is a caching server, it receives requests and it responds to requests, it does all this on behalf of the actual web server. The web server interacts with Varnish, and vice-versa. The actual magic happens when the Varnish server begins to store responses in the memory of the server for repetitive requests, which acts like a direct cache. Varnish can then quickly check each request and see whether it already has a record of it and send it out much more quickly, without putting any extra strain on the actual backend server.
You do need a server that has a bit of memory (ram) available, but other than that, getting Varnish up and running isn't very difficult, and might be much more appealing to larger sites, than to rely on a PHP script to do all the caching for you.
Alternative PHP Cache (APC)
Alternative PHP Cache is a free, open source (PHP license) framework that caches the output of the PHP bytecode compiler in shared memory, thus reducing parsing and disk I/O overhead for later requests; and a shared memory cache for user data. For an application consisting of a large source code base such as Drupal, a 3x increase in page generation speed is possible as a result.
It takes less than a couple of commands to install APC on an Ubuntu server. It provides a two-way solution to clearing cache: a PHP script that can be run from the browser, or a direct command clear from the shell console.
WordPress Caching and Potential Issues
Caching is a big deal for large sites, because it allows to save resources while providing a better user browsing experience. Trying to game the system to avoid using a caching plugin is nothing but a waste of money, time and resources. We hope these tips and tricks, and insights give you a better idea of the direction to take with caching for WordPress or website caching in general.
5 Best WordPress Cache Plugins to Speed Up a Site
- WP Rocket
WP Rocket is WordPress cache plugin with impressive features, and very easy to use. WP Rocket has preset settings that’ll be applied to your site as soon as you activate the plugin. It is the most beginner-friendly cache plugin you can find, thus, you don’t have to understand much about caching to get started.This plugin works for both beginner and more experienced website owners. If you are an advance about caching, you can freely adjust the settings. There are also some optional settings you can activate to make your site even faster.
- WP Super Cache
Develop by Automatic, WP Super Cache is the most popular cache plugin at WordPress.org. The big benefit of WP Super Cache is simplicity. You can just turn the caching functionality on and it covers all the necessities of caching and will speed up your website by serving users cached versions of your pages.
- WP Optimize
- SG Optimizer
Developed by SiteGround to dramatically improve WordPress website performance on any hosting environment. SG Optimizer is a plugin specifically for WordPress sites hosted with SiteGround. It’s a cache plugin, but it goes beyond that to help you compress your images, combine files, minify your HTML, CSS, and JS, and more. This plugin is usable both by beginners and more advanced users.
- W3 Total Cache
W3 Total Cache (W3TC) improves the SEO, Core Web Vitals and overall user experience of your site by increasing website performance and reducing load times by leveraging features like content delivery network (CDN) integration and the latest best practices.