What the H double T P? If site loading slowdowns have you shaking your fist, it’s probably time to cache out.
When it comes to fast loading WordPress sites, caching is crucial. A well-optimized page cache can dramatically improve page load speed for visitors, and reduce the load on your server.
You have a slew of options when it comes to caching. You could go with a caching plugin from WordPress.org (there are many, so we compiled a “best of the bunch” short list), or a caching module installed on top of a web server.
Of course the caching method you choose will produce greatly varying results in terms of the quality and impact on your site performance. So what’s the best option?
Continue reading, or jump ahead using these links:
In this article, we’re going to look more closely at what static server cache is, explain why we recommend FastCGI (with a peek into Static Server Cache FastCGI), and how implementing it can optimize your site speed and user experience.
Let’s get started.
Rendering or fetching a page or post in WordPress requires queries to be sent back and forth from the database. A lot of these posts and pages won’t be updated everyday.
Rather than the server interpreting the site code itself, querying the database, and returning an HTML document back to the customer and finally loading the page, static caching saves a single result from the first two steps and provides that document to anyone else making the request.
Caching in WordPress has multiple benefits, the top amongst them being: speed and performance boosts, hosting server load reductions, and more favorable rankings with search engines. As stated in prior optimization articles, this will be affected by other metrics as well, as there are many components that factor into speed and performance.
There are different caching modules, such as Varnish and FastCGI, along with different types of web servers, such as Nginx, Apache, and LiteSpeed. These modules and servers work in tandem to provide superior caching.
Varnish is a web application accelerator, also known as a caching HTTP reverse proxy. One of its key features is its configuration language, VCL. Offering great flexibility, VCL enables you to write policies on the handling of incoming requests, such as what content you want to serve, where you want to get the content from, and how the request or response should be altered.
Nginx (pronounced Engine-X) started as a simple web server designed for maximum stability and performance, and has evolved into a multi-performance powerhouse, with capabilities to handle reverse proxy with caching, load balancing, WebSockets, index files & auto-indexing, FastCGI support with caching, and more. As the fastest‑growing open source web server, with more than 450 million sites dependent on their technology, Nginx is incredibly stable.
We believe FastCGI, served by Nginx, is the cream of the crop. Read on for why.
FastCGI―an enhanced version of its predecessor, CGI (Common Gateway Interface)―is a binary protocol for interfacing interactive programs with a web server. It’s primary function is to reduce the overhead related to interfacing web server and CGI programs, allowing a server to handle more web page requests per unit of time.
Instead of creating a new process for each request, FastCGI uses persistent processes to handle a series of requests. Using Nginx FastCGI, when a user visits the same WordPress page as they did prior, your website will not perform the same PHP and database requests again because the page is already cached and served by FastCGI. Thus, users will have a much faster server response time after the initial visit.
You’ll also have reduced PHP-FPM and MariaDB (MySQL) load, as well as lower CPU usage. And finally, your server will be able to handle more traffic with the same specs, enabling you to better meet more demanding needs.
For a visual on how these elements work together for superior caching, see the infographic below. (We’ll talk about object caching in a bit.)
All WordPress pages can gain huge benefits when using FastCGI.
There are two content types to consider when setting your cache: static and dynamic.
Static content is any file that is stored in a server and is the same every time it’s delivered to users. Dynamic content changes based on factors specific to the user such as time of visit, location, and device.
Social media pages are a good example of dynamic content. Twitter feeds look totally different for any given user, and users can interact with the content in order to change it (e.g., by liking, re-tweeting, or commenting).
E-commerce sites are commonly heavy on dynamic content as well. With WooCommerce, for example, certain pages like Home, Shop, and single product pages can be fully cached. However, Cart, Checkout, and My Account pages should be excluded. You do not want to page cache these dynamic pages fully as the latest changes would not be seen.
Dynamic web pages are not stored as static HTML files. Generated server-side, these typically come via origin servers, not from a cache. Since dynamic content can’t be served to multiple users (as it’s unique to each one), it’s difficult to cache. However with advancements in technology, caching dynamic content is possible.
One way to speed up dynamic web pages is to use dynamic compression. In this manner, the content still comes from the origin server instead of a cache, but the HTML files generated are made significantly smaller so that they can reach the client device more quickly.
Just as page caching works on HTML page output, object caching works on your database queries. Object caching is a fantastic solution for caching dynamic content.
Like the other caching components we discussed, there are several persistent object cache contenders in the field, the most well-known being Memcached, Redis, and APCu.
As far as setting your caching policies goes, there isn’t a one size fits all. However, what determines a more or less desirable static cache policy is basing it on the type of content your site is comprised of.
For sites where user comments are steadily being added & approved (often by the minute), or frequent new content is the norm, you should structure your cache policy to clear more often, such as daily or even hourly.
For content that is regularly updated, just not that often, a 30-day cache policy is more than enough.
For static elements like logos, images, page fonts, JS, and core CSS stylesheets, you can extend the max age to one year.
Even Google says there’s no one best cache policy, but they do offer some tips to assist in devising your caching strategy, beyond the scope of your static assets. These are:
- Use consistent URLs
- Ensure that the server provides a validation token (ETag)
- Identify which resources can be cached by intermediaries (like a CDN)
- Determine the optimal lifetime for each resource
- Determine the best cache hierarchy for your site
- Minimize churn (for a particular part of a resource that is often updated [e.g., JS function or set of CSS styles], deliver that code as a separate file)
Popular site speed performance testers, GTmetrix, consider resources cacheable if the following conditions are met:
- It’s a font, image, media file, script, or stylesheet
- It has a 200, 203, or 206 HTTP status code
- It doesn’t have an explicit no-cache policy
If you use a CDN like Cloudflare, you can set your cache policies through your account. Additionally, if you use our Hummingbird plugin, you can access these settings via the built in integrations for Cloudflare.
As a WPMU DEV hosted member, you can access the primary Static Cache settings through The Hub to enable the extremely efficient static cache policy.
Ultimately, how you design your cache policy should be based on the type of content you serve, your web traffic, and any application-specific needs that exist for that new new data.
There are a number of tools you can use directly within WordPress that make implementing a static cache policy quick and easy. We’ll look at those next.
A quick search for caching plugins on WordPress.org will return in excess of a thousand results. That’s a lot of options to wade through. We handpicked a few that we believe to be solid options.
Hummingbird is a one of a kind, world-class caching suite, active on more than +1 million websites.
With Hummingbird’s WordPress speed optimization, your pages will load faster, your search rankings and PageSpeed scores will be higher, and your visitors will be happier. In fact, speeding up your site has never been easier.
Hummingbird scans your site and provides one-click fixes to speed up WordPress in a flash. And it’s completely free. (Consider Smush as well; while not a static caching solution, it will compress and lazy load your images for marked speed improvements, and is also free.)
With more than 1.5 million users, WP Rocket is a favored caching plugin for WordPress. It’s a premium service, which you can only install directly from their website.
It’s easy for non-techie users to understand, while more knowledgeable developers can customize it to their liking. It’s compatible with many hosting providers, e-commerce platforms, themes, and other plugins.
WP Rocket automatically starts caching your pages, without any need to tweak the code or mess with settings. Pricing starts at $49, for 1 website/1 year.
WP Super Cache is from the team behind WordPress.com and WooCommerce… Automattic. This plugin is free, and has an astounding 2 million+ active installations.
WP Super Cache serves cached files in 3 ways, which are ranked by speed. Expert (the fastest), bypasses PHP by using Apache mod-rewrite to serve static html files. Simple (mid-level speed, and the recommended way of using the plugin), uses PHP & does not require configuration of the .htaccess file, allowing you to keep portions of your page dynamic. WP-Caching mode (the slowest), mainly caches pages for known users, and is the most flexible method.
WP Super Cache comes with recommended settings, one of which is: If you’re not comfortable with editing PHP files, use Simple mode.
W3 Total Cache (W3TC) has over a million users, with an average rating of 4.4 out of 5 stars. It is a free plugin.
W3TC improves the SEO and user experience of your site by increasing website performance, and reducing load times, leveraging features like CDN integration and the latest best practices.
W3 Total Cache remedies numerous performance-reducing aspects of any website. It requires no theme modifications, modifications to your .htaccess (mod_rewrite rules) or programming compromises to get started. The options are many and setup is easy.
WP Fastest Cache is another million+ user caching plugin.
Setup is easy; no need to modify the .htaccess file (it’s done automatically). It’s got a more minimal set of features, including SSL support, CDN support, Cloudflare support, preload cache, cache timeout for specific pages, and the ability to enable/disable cache option for mobile devices. WP Fastest Cache is also compatible with WooCommerce.
LiteSpeed Cache for WordPress (LSCWP) is an all-in-one site acceleration plugin, with more than 2 million active installations.
LSCWP does require use with a web server (LiteSpeed, Apache, NGINX, etc.). It supports WordPress Multisite, and is compatible with most popular plugins, including WooCommerce, bbPress, and Yoast SEO.
LiteSpeed Cache is free, but some of the premium online services provided through QUIC.cloud (CDN Service, Image Optimization, Critical CSS, Low-Quality Image Placeholder, etc.) require payment at certain usage levels.
Ok, now that we’ve covered some viable plugin options for caching, let’s look at what you can do with the cache settings in WPMU DEV’s hosting platform.
The best WordPress hosting providers―leading in sales and racking up rave reviews―have caching built in. Without it, they wouldn’t be competitive enough in today’s market of tech-savvy web developers.
If you’re looking for tools that are integrated on managed WordPress hosting environments, WPMU DEV Hosting, WPEngine, Flywheel, and Kinsta all have caching built in. Quite frankly, the systems used by hosting companies are quicker and more effective than WordPress plugins.
With WPMU DEV hosting, we use our own mega caching tool, Static Server Cache. This is page caching at the server level using FastCGI. Much faster than any PHP plugin, Static Server Cache greatly speeds up your site and allows for an average of 10 times more concurrent visitors.
Understanding and managing the settings for caching in WPMU DEV hosting is an easy, hassle-free experience. C’mon along and you’ll see what I mean.
From your WordPress admin page, go to WPMU DEV, Plugins, then click on The Hub icon.
Next, from The Hub landing page, click on the site of your choice, under My Sites.
From here, click on either of the Hosting headers.
Next you’ll click on Tools, and scroll down to Static Server Cache. Click the Off button, then click Continue from the “Turn on Static Server Cache” popup window. (Note: Static Server Cache will be enabled by default for all new server/hosting accounts created with us.)
Turning Static Server Cache on is a breeze through The Hub.
You can also do a quick manual clear of the Static Server Cache from here. Simply click the Clear button, then click Continue from the “Are you sure?” popup window.
Static Server Cache is fully integrated with our Hummingbird performance plugin, so any action or process in Hummingbird that triggers clearing of the page cache will clear the Static Server Cache as well.
For example, if you click the Clear Cache button in the Hummingbird plugin and have Page Caching enabled in settings, the Static Server Cache will be cleared as well. Likewise, if you have options like Clear cache on interval or Clear full cache when post/page is updated enabled in Hummingbird, Static Server Cache will follow suit with those settings.
WooCommerce is also supported by default, hence any dynamic process in Woo is not cached. So if a user on your site adds items to their cart, that would not be cached by the Static Server Cache.
Below is an itemized list of what does or does not get cached when Static Server Cache is enabled. (Note: The max size of any item is 1 GB.)
- GET/HEAD requests (that’s your content; e.g., posts, pages, etc.)
- POST requests (e.g., forms or any other frontend submission)
- Query strings
- wp-admin, xmlrpc, wp-*.php, feed, index.php, sitemap URIs
- If these cookies are found:
comment_author, wordpress_, wp-postpass, wordpress_no_cache, wordpress_logged_in, woocommerce_items_in_cart
- If these WooCommerce URIs are found:
/store, /cart, /my-account, /checkout, /addons
If you want to check if any page is being cached by our Static Server Cache, pull up our detailed documentation for a walkthrough.
Please note that Static Server Cache is not enabled on staging sites.
Caching is a reliable and worthy solution to improve your pages’ load speed, and thus your users’ experience. It’s powerful enough to allow refined subtleties for specific content types, but yielding enough to allow easy updates when your site content changes.
While many forms of caching are available, static caching is a method for converting the page generated by a user’s request into an HTML document to serve any subsequent requests to that same page.
Caching images and other static objects will certainly speed up page load time, but caching items such as full HTML documents is what can really amplify a website.
If you’re looking for a full-featured caching solution, then WPMU DEV’s Hosting plan might be your answer. Pair our FastCGI, accessible via the streamlined Hub interface, with our caching queen, Hummingbird, for the speed round’s 1-2 knock-out punch. With our 30-day money-back guarantee, you’ve got nothing to lose!
If you’re a WPMU DEV paid plan user, you already enjoy the full functionality of this feature. Not a member yet? Try it for yourself, free for 7 days, and see why we have so many five-star reviews.
Whatever method you opt for, you’re well advised to put caching tools and policies in place, so response and loading time is never a hindrance to your visitors’ experience, or your conversion success rates. As someone once said… Cache is King!
Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch)
Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.