Today, I’m happy to announce the release of Servebolt Optimizer version 2.0 for WordPress, which includes smart and automatic purging of Cloudflare cache on post, page, product and any custom post type update.
Being a performance centric web hosting company, we see the “purge everything” button as a threat against web performance. Every time you hit this button, your website will slow down until caches have been built up again. Therefore, we have invested heavily in fixing this problem. And as such, we are now introducing fine grained cache purging in Servebolt Optimizer v 2.0.
Last year, we entered the new Cloudflare Partner Program as one of the first partners on the globe. Since then, our collaboration with Cloudflare has become tighter, and we’re working on integrating Cloudflare more and more into Servebolt. Servebolt and Cloudflare in tandem is a perfect combination, providing best-in-class performance, security and much more!
In addition to the new automatic purging of Cloudflare cache, we have also implemented Cloudflare’s new API authentication, API tokens, and improved the overall quality of the plugin.
Purging Cloudflare cache in WordPress
At Servebolt, we believe in a clever use of caching and not using caching as the main performance enhancement. This means that, for instance, a WooCommerce store only caches HTML for non-logged in users and never cache cart and checkout pages which are unique for everyone. Having a cache strategy like this results in the best load times possible for most of the users. It also enables the developers of a site to stop spending a lot of time configuring cache, freeing up their time to focus on PHP and database query performance.
Spending time on PHP and database query performance will result in better load times for the users that cannot be served a cached version, and increase the site’s ability to scale. Our way of thinking and handling cache is also reflected in the way how we handle Cloudflare cache purging in our Servebolt Optimizer version 2 of the plugin.
Automatic cache purging
The most important thing we have done – different from most other Cloudflare implementations in WordPress – is automatically purge a single post when it has been updated. This is different from most cache purging implementations which usually purge everything. Doing so would result in a temporary decreased performance until the cache has been filled again.
Why not do cache warming instead?
A way of mitigate the temporary decreased performance due to purging everything could be to “warm the cache”. This means you’d use a bot or spider to run through the pages on a site and forcing those page into the cache that way. This principle works, but it will also use a lot of CPU resources generating pages which do not necessarily have a lot of traffic.
How the automatic purging of Cloudflare cache works
The smarter way of working with cache is to only purge the cache for URLs that have updates and need to be purged from cache. And that is exactly what we do in the new version of Servebolt Optimizer.
When you update a post, product, or any other post type, we send a purge request to Cloudflare. We also figure out which taxonomies (category, tags, etc) that single post belongs to, and purge those as well. Additionally, we purge the frontpage to ensure that the frontpage is properly updated. This way, you only purge the required pages and not pages without any updates.
Using the automatic purging of Cloudflare cache in Servebolt Optimizer will result in better performance for all your visitors and customers.
Full page caching without blocking your workflow
Doing cache purging the way we do it in the newest version of our plugin, smart and automatically, is a better way of working with cache purging. The best part is that it does not require any technical knowledge. Nor does it require you to change your workflow when adding or updating or content on your site. You publish your changes, and it will be visible to anyone within a minute.
In version 2.0, you have two ways of triggering the cache purging; by cron or immediately. Purging by cron will put all updated posts in a queue to be purged, and then cron will work through the queue.
When to use purging by cron
Working through the cache purging queue with cron is good for setups where updates are done in bulk. Examples would be a WooCommerce store with bulk updates of prices, or integrations that update content in bulk, for instance.
Purging via the cron can also be smart to use in cases where a lot of updates are happening at the same time by multiple people. This will limit the number of times, for instance, the frontpage is purged within just a few minutes.
A great example of how you can use the cron purging is how we’ve integrated this into our own content management workflow for servebolt.com. On Servebolt.com, we have a separate environment where we updates our content, our posts, pages and so on. This environment is locked down to Servebolt employees, and unavailable to the public.
When we have a package of updates ready across the entire site we push those changes to the public environment (the actual live site you’re seeing now) by using a script. This script creates a dump of the database and copies both files and the database dump to our public environment. It then imports the database and pushes the new version live. This is all done with an atomic switch so to prevent the site from ever being down during this process. We can with our new version configure the plugin to not purge when we publish the post in our content development environment, but when the update hit the public environment.
Easily purge cache from the admin bar
We have, in addition to the Cloudflare auto-purging feature, added an easy way to flush the cache completely. Once you’ve configured the Cloudflare Integration, you will find this option under the Servebolt admin bar menu item Servebolt Optimizer.
Using Cloudflare API Tokens
In this version of Servebolt Optimizer, we’re happy to announce that it supports the newly launched API authentication method from Cloudflare: API tokens. The difference between using your API key and the new API tokens, is that the API key gives the integration full access to everything in your Cloudflare account. All actions, to all zones. In many scenarios, you do not want to give the integration full access to read and edit anything.
The solution to this is using Cloudflare’s new API authentication API Tokens. With API Tokens, you can configure what a specific token will be allowed to do. For instance only purge cache. Learn more about how to connect Cloudflare to your site.
In Servebolt Optimizer, you can now choose between the two ways of authenticating; Either use the API key, or use the API Tokens.
Next step for Servebolt Optimizer
That’s it for version 2.0 news. This major overhaul of our Servebolt Optimizer plugin makes it a lot easier to add future additions. And as such, we’d love your feedback in the comments below on what should be the next step for Servebolt Optimizer.