As a savvy website owner, I’m certain you understand how important it is for your website to load quickly. And if you run your website on WordPress, you’ve probably at least heard of the need for caching plugins before.
Caching is a critical aspect of your website’s performance as it can greatly improve loading times. By a lot.
In layman’s terms, a caching plugin creates a static version of your website when a visitor lands on it and then serves that static version to the visitor the next time they land on your website. Thanks to that, your website loads faster for your visitors which has several benefits.
There is a lot of buzz around the internet when it comes to website loading times. A website that loads fast provides a better user experience overall and leads to more engagement and better conversion rates.
Even Google announced that website loading times will play a role when it comes to your search engine ranking. And studies show that if a website takes more than two seconds to load, visitors are more likely to abandon it and go elsewhere.
To find out where you’re at currently, testing your website’s speed is a good idea. Let’s take a look at a couple of tools that can help you accomplish this:
Pingdom Tools will summarize your web page performance at the top with four metrics:
The most important metric is, of course, the load time. When Google visits your site, how fast it loads is one of the first thing the crawlers look at.
To get an accurate average load time, you should run the test several times since it will not be identical every time. The reason this happens is because the first time someone visits your website, including a Pingdom bot, they will get a non-cached version of your website. That first visit will trigger cache generation so a subsequent visit will result in the visitor getting a faster, cached version of your website.
Another tool which can help you determine how fast your website loads is YSlow.
YSlow is available as a browser extension. It works by analyzing your page and telling you why it’s slow. It generates a checklist of suggestions and tweaks you can implement to reduce the page loading time and improve the overall user experience.
However, knowing how fast your website loads is only half the battle. In order to provide an optimal user experience, you should take advantage of WordPress caching and do what it takes to improve the loading time of your website.
That said, WordPress caching is a topic that can get quite technical and complex, and as a result, a lot of website owners don’t understand what is really going on under the hood of their sites. This can lead to frustration when things don’t work as they should.
So how does caching work? Let’s delve into the subject of WordPress caching fully now to see what it is, how it works, and what plugins and solutions are available to help you implement it.
What is WordPress Caching
Essentially, this is what happens:
A user from anywhere in the world visits your website and their browser contacts your Web server.
Your WordPress installation contacts the database where it’s installed to fetch your posts and other stored data.
The Web server then compiles this data into an HTML page and returns it to the user.
Since WordPress generates content dynamically this means that it requests fresh information about a page every time a visitor views a page. In most cases, this is unnecessary as your blog posts and pages don’t change once they are published unless you manually go and edit them.
When you use a caching plugin, it creates a static version of your content and delivers it to your visitors, which means that when the same visitors come to your website again, they will see the cached version, which should be much faster.
In a nutshell, caching is reusing data from previous requests to speed up any future requests. It minimizes the amount of data that needs to flow between the browser, the database, and the web server which translates into faster loading times.
How Does WordPress Caching Work?
There are two primary types of caching protocols available, based on the client-server model: Client-side caching and server-Side caching.
This process is known as client-side caching and almost every modern website uses it and every browser supports it.
Server side caching includes all the various caching protocols that are used under WordPress caching. They include the following:
Database query caching
Let’s take a look at each of them individually and see how caching can help you speed up your website.
Page caching is the simplest of all the caching protocols. It refers to the process of saving the dynamically generated HTML files on the server’s hard disk or memory and serving them from the cache every time a request is made. This saves the overhead of executing PHP code and MySQL database queries.
The aim of a database is to store, update, and deliver data efficiently. Databases are usually huge and each query takes a significant amount of time. Since WordPress relies heavily on its database, it makes a query every now and then. If that data isn’t altered in the database, executing queries to retrieve the same data is the same as re-downloading the same images and files over and over again. To prevent that from happening it makes sense to save the results of a query in the local storage. That’s known as database caching and is one of the fundamental factors of effective WordPress caching.
But, once the database is updated–which happens when you update a post or a page or add a new post or someone submits a new comment–it’s important to delete the previously saved database cache and re-cache the database query results all over again. This prevents irrelevant or erroneous database query results.
WordPress has its own internal caching system which includes several subsystems such as the Caching API, Object Cache, and Transient API. This caching system can be controlled by plugins to reduce the number of database calls. However, this is a pretty advanced topic which isn’t quite relevant for regular everyday WordPress users.
Opcode caching refers to the saving of the compiled PHP code between every request. WordPress at its core uses PHP which is an object-oriented programming language. This means that in order for a PHP code to be executed, a PHP compiler must compile the code first and generate the executable code which will be executed by the web server.
In other words, opcode caching is storing the output of the PHP compiler in the cache.
To implement server-side caching of any form, the data must be stored in the local storage. Local storage refers to either the server’s hard disk or the server’s primary memory i.e. RAM.
RAM, which stands for Random Access Memory, is usually much faster than hard disks. It’s a form of volatile memory and usually the primary storage. Hard disks, on the other hand, are non-volatile secondary storage which is more expensive.
The storage you use to save the cached data plays an important role. Hard disks are slower so the speed of the HDD matters. In most cases, hard disks used on servers range from 7,200 RPM to 15,000 RPM and may have different RAID (redundant array of independent disks) levels – RAID 0 is the fastest but also most insecure, while RAID 4 has a proper balance of speed and security.
If you use a shared hosting server, like most website owners, your only choice is to store the cached data on the hard disk. If you, on the other hand, have a dedicated server or a VPS, then you also have the additional option of using RAM as your storage for cached data.
To Cache or Not to Cache
The biggest benefit of using WordPress caching is improving your website’s loading time. That alone is reason enough to install and use a caching plugin. However, there are times when caching seems to break things. Why does this happen?
The reality is that most modern websites have a lot of fancy features, i.e. content that updates automatically without you doing anything. If you have a widget on your site that displays your Twitter feed, that widget is automatically updated without you having to manually update it.
Likewise, if you have an online store on your website, then the cart updates automatically when a visitor adds a product to it, and it also updates differently for each visitor.
This type of content will usually be the first thing to break with a caching plugin enabled. If those plugins aren’t coded properly, your visitors will not see an updated cart; or your Twitter feed will not display a list of your most recent tweets.
If you have those features on your website, then you need to make sure they are not using PHP to display the output because PHP will not run on a cached page.
Finally, a third solution is to turn off caching for that page or remove the feature if it is less important for user experience than speed.
Caching Plugins Overview
Bear in mind that you should always turn off and purge the cache when you are making changes to your website’s theme. This ensures that you’re seeing the latest version of the page and not a cached one.
So let’s take a look at the best options available for caching plugins.
Hummingbird is a performance optimization plugin with a goal of helping you optimize your website and make it load faster. When you first activate Hummingbird, it shows you how your website scores on a scale to 100, then gives you a breakdown of what you need to improve. The suggestions are written in clear and easy-to-understand language and includes a list of the specific files you need to edit, as well as the images you need to compress, so you can get started right away.
It’s similar to Google’s Page Speed tool but the difference is it gives you the explanation using terminology you can actually understand and it eliminates the need to manually find and replace the files that are causing load time issues. All the changes are done with a click of a button and all the optimizations can easily be undone.
One area where Hummingbird really shines is eliminating render-blocking issues. It’s one of the most common issues when it comes to website speed, and often the one that requires the most time, considering you have to write down and locate each and every file that’s causing render-blocking issues.
Hummingbird lets you see exactly which files are causing issues by listing their names so you can then decide whether you want to move them to the footer, header, or leave them in their original position. You can also choose to combine and minify them to improve site performance.
Hummingbird can also help you with minification, browser caching, gzip compression, and even be configured to monitor your site’s uptime.
Hummingbird is available as part of our WPMU Dev membership for $49/month.
W3 Total Cache (W3TC) is one of the most powerful free caching plugins in the plugin repository. It is the only WordPress Performance Optimization framework designed to boost user experience and improve page load times and it comes highly recommended by some of the top hosting providers in the industry including Page.ly, Flywheel, and SiteGround.
Out of the box, it may seem quite complicated and overwhelming since its Settings area is divided into 16 pages. However, the upside is that you don’t have to manually configure the settings to make the plugin work – its default settings work pretty great, too.
WP Super Cache is the second most popular caching plugin which also happens to be very user-friendly. It is very easy to get started with, and suitable for even beginner users. It does have fewer features than W3 Total Cache but the good thing about this plugin is that by simply enabling the caching option, you will give your site a significant increase in speed.
It offers three options for decreasing load times:
Use mod_rewrite to deliver static pages
Serve static pages using PHP
Use a legacy caching mode that caches pages for users who are logged in
Other features include page compression, dynamic caching, CDN support, mobile caching, and a scheduler.
WP Fastest Cache is another user-friendly and simple caching plugin. Its developers claim the WP Fastest Cache plugin is “the simplest and fastest WP Cache system.”It generates static HTML files based on your dynamic WordPress blog and saves it in the cache.
Other features include auto-delete of cached rules when a post or page is published, CDN support, SSL support, a toggle on/off for mobile logged-in user caching, and more. The downside of WP Fastest Cache is the lack of support for multisite installations at the time of this writing.
WP Fastest Cache is free with the option to purchase a premium version.
WP Rocket is the newest caching plugin available for WordPress. It is very user-friendly and works correctly immediately after activation which is a huge benefit for those who aren’t tech-savvy.
What makes it different from other caching plugins is its lazy image loading feature which means the images you have set on your page are loaded only when the user scrolls down the page. This non-preemptive approach significantly improves load times.
WP Rocket is available for $39 for a single site license, $99 for use on three websites, and $199 for use on unlimited websites.
All data sent over the HTTP protocol can be compressed on the server. Instead of sending huge amounts of data, HTTP compression enables the server to send a smaller data stream to the Web browser, which decompresses and displays it. This reduces the number of bytes sent between your Web server and your users, resulting in decreased page load times.
Script and Stylesheet Minimization
Finally, the last recommendation on our list is to optimize images on your website. By now, I’m pretty sure you know that using uncompressed images only adds to your website loading times. By properly compressing images–resizing them to the proper dimensions and saving them in a format optimized for the web–you can improve load times dramatically.
Using a tool such as TinyJPG.com or TinyPNG.com, you can ensure that your images retain their quality while being properly compressed for the web. If you already have a number of images on your website, a plugin such as WP Smush Pro can compress your images while maintaining their quality to dramatically improve your website’s page speed. With WP Smush Pro, you can bulk optimize images up to 32MB without timing out, and even resize your images – no more having to deal with confusing Photoshop settings.
Website speed plays an important role in the overall performance of your website. The best way to make sure your website provides great user experience and boosts your search engine rankings is to take advantage of a WordPress caching plugin.
There are many different caching plugins and they all work differently depending on a number of factors which include the type of hosting plan you’re on, whether your server and caching plugin have been configured correctly, the type and abundance of content on your page, and so forth.
The only way to find out which caching plugin is best for you is to test them out for yourself, with your own site and hosting service.