We’re constantly working to improve the tools you have at your disposal as a Servebolt client. This has resulted in a new update to our Servebolt Optimizer WordPress plugin. We’re excited to share the new 3.2 version of the plugin with you. We saw ways to improve further the performance and the raw speed of your WordPress site in two different ways.
The features introduced in this version revolve around two particular topics. Namely, performance and improved caching.
We’ve been looking at various ways of how we can further help Servebolt clients in optimizing their sites for speed. Servebolt Optimizer 3.2 introduces two very specific features that will help you speed up your WordPress site.
As Erlend Eide, our CEO, outlined in his article on Servebolt’s stance on sustainability, we want to help you create the most efficient version of your site on the most efficient and resource-friendly hosting. To that end, we started looking at WordPress menus.
Rendering a WordPress menu is a highly inefficient process. Whenever your WordPress theme declares a menu to be output on the front end, your WordPress installation will query the database. So every single time a page with a menu on it is viewed, the information needed to build that menu is retrieved over and over. Again, that’s not very efficient as menus hardly change ever.
With this version 3.2, you will now have the option to cache menus – inspired by Bjørn Johansen’s code. This means that a cached version of your menus is used to render the menus on the front end instead of querying for that information on every single page load. This is a feature that you’ll need to double-check if it works in your particular WordPress installation. You can easily test this by turning on this feature in the Performance Optimizer section of the Servebolt Optimizer plugin under the tab “Menu Cache.”
We have seen optimized menus shave off as much as 75ms on the Time to First Byte (TTFB) in our tests. The final result for your site will depend on the size of the menu(s), of course.
Faster Loaded Translation Files
If you’re serving your WordPress site in any other language than the default
en_US , you’re already at a disadvantage if you’re looking at raw site speed. In order for WordPress to display text strings on the front-end in its translated equivalent, it needs to load the translation files (
.mo files to be specific) during runtime.
Every single thing that has to be loaded when rendering a website costs time. As such, we started looking at how we could improve this. Especially considering it’s not just WordPress’ Core translation files being loaded but also your theme and plugins’ translation files. There are a lot of translation files being processed every single time you view a page.
And we found a way! What Servebolt Optimizer 3.2 does now is that it reads the
.mo-file using the WordPress MO-reader class. We then extract all the entries from this class and store them in a WordPress transient. We’re then using
filemtime to detect when a translation file is updated so that the cache is purged on updates etc.
Implementing this feature, inspired by code Per Søderlind wrote, allowed us to see a 40ms decrease in load time!
Cache Policy Improvements
Servebolt Optimizer 3.2 not only brings improvements to the speed of your site by caching elements internally. It also introduces improvements in cache policies for Accelerated Domains, specifically with regard to various types of content or Post Types in WordPress terminology.
Some post types are safer to cache for a long time, while others should have a lower cache time. We’re introducing a system where you can set the cache time per post type as well as taxonomies. We’re allowing you to choose from a list of pre-defined cache lengths, or you can set a custom one.
We also introduced a couple of refinements based on feedback we received.
- Improved automated cache purging. The automatic cache purge has been improved whenever:
- A post/term gets deleted then the cache gets purged.
- An attachment gets updated (resized, cropped, etc.), and we purge the cache for URLs, including all image sizes if the attachment is an image.
- A post gets excluded from the HTML Cache then we also purge the cache.
- More fine-grained access control to cache purge feature – Previously, only administrators could purge the cache. This is now changed using more fine-grained capability checks. Administrators and editors can now purge cache, while authors can purge cache for their own posts. Contributors and subscribers cannot purge the cache.
- Better Jetpack compatibility. Previously the Jetpack Site Accelerator was in conflict with Accelerated Domains. This is now fixed with Site Accelerator being disabled whenever the Accelerated Domains or Accelerated Domains Image Resize feature is active.
Both the cache improvements and cached menus are fixing performance issues in WordPress that we feel should already be in place but aren’t. There’s a Trac ticket addressing the optimizing translation files issue, but after years of seeing the issues raised, there’s still no movement on them. With Servebolt Optimizer, however, you don’t have to wait for those issues to be fixed in WordPress Core, we’ve fixed them for you!