• oik-unloader: WordPress performance improvement plugin

    oik-unloader: WordPress performance improvement plugin

    My latest plugin, oik-unloader, is a WordPress performance improvement plugin. Its job is to unload unnecessary plugins on demand. This post explains what it does and documents the results of my performance tests to determine the effectiveness of this plugin on live sites. Before we dive into that, let’s have a look at some of the top performance tips.

    10 top tips to improve WordPress performance

    If you do a search for “WordPress performance improvement” you’ll probably find a number of posts listing tips for optimizing your WordPress website. Here are ten of the top tips.

    1. Choose a good WordPress host
    2. Use a fast theme
    3. Optimize your images
    4. Minimize your homepage
    5. Remove plugins you don’t use
    6. Use inline CSS/JS or minified files
    7. Use excerpts on home page and archives
    8. Use a caching plugin
    9. Optimize your WordPress database
    10. Use a Content Delivery Network (CDN)

    How to improve performance

    One way to make your site faster is to give it more computing power. Another way is to make the server do less. And a third way is to make the browser do less.

    Let’s classify the top 10 using these methods.

    1. Choose a good WordPress host – more computing power
    2. Use a fast theme – server do less, browser do less
    3. Optimize your images – browser do less
    4. Minimize your homepage – server do less, browser do less
    5. Remove plugins you don’t use – server do less, and potentially browser do less
    6. Use inline CSS/JS or minified files – browser do less
    7. Use (hand crafted) excerpts on home page and archives – server do less
    8. Use a caching plugin – server do less for repeat requests, certain users
    9. Optimize your WordPress database – server do less
    10. Use a Content Delivery Network (CDN) – server do less

    Let’s look at the first five in a little more detail.

    Choose a good WordPress host

    If you don’t have good hosting then you’re just pissing into the wind. You’re trying to get your site to respond to each request in under half a second. If you can’t get one request to run in half a second then you’re stuffed. My sites aren’t particularly busy, but as you’ll see from the results below my hosting is good enough at present. By the way, I use SiteGround. And on some sites I’m also using the SiteGround Optimizer plugin.

    Use a fast theme

    A fast theme will be coded efficiently to reduce both server and browser processing. It will satisfy tip 6. It may also help you satisfy tips 4 and 7. Full Site Editing themes appear to be a lot faster than many premium themes.

    Optimize your images

    There are “new” image formats and compression techniques which allow image file size to be much smaller while still looking good. See Image size reduction by quality WordPress has started to introduce support for these images – allowing WebP files (.webp). But WordPress core doesn’t cater for legacy uploads of JPGs and PNGs, nor fallback on devices/browsers which can’t display the new image formats. There are plugins that are designed to help, for example WebP Express. Using WebP Express may help the browser, but there could also be a small server overhead.

    Minimize your homepage

    The less you put on your home page the faster it will be. Do you still need that fancy slider? Could you not take each image in the slider and make it a slightly longer page with lazy loading of the images below the fold? And can you reduce the HTML, CSS and JavaScript needed to provide the animations popular on many sites?

    Remove plugins you don’t use

    Now we’ve got to the tip that my new plugin addresses. You’ve got all these plugins in your site. It’s likely that each one was installed to perform a particular purpose. There’s definitely somewhere in your site that the plugin is needed. But is it needed on the home page? Some plugins are only used in the admin pages. Others provide blocks, shortcodes or some other functionality that’s only needed in specific areas of the site? Do these plugins play nicely and only do things when required or do they assume that they’ll always be needed?

    There’s a small but measureable overhead for each plugin file that’s loaded, each function that’s run and each database access performed.

    One way to make your server do less is to reduce the number of activated plugins. Wouldn’t it be nice to be able to do this on demand.

    Keep the plugins you really do need, but only load them when actually required.

    oik-unloader: WordPress performance improvement plugin

    Remove plugins you don’t use, but only when you’re not using them.

    Herb Miller, October 2021

    The oik-unloader plugin is a general purpose WordPress performance improvement plugin that deactivates plugins on demand.

    For each URL where you’re trying to improve performance, you tell it which plugins you don’t need to be activated. It will dynamically deactivate these plugins, which means they won’t get loaded. In other words they’re unloaded. This should make your server do less.

    There is also the chance that the site visitor will notice the browser do less because

    • the plugin is no longer delivering content to the browser
    • which means the browser doesn’t have to do things with that content:
      • render HTML,
      • load and display images,
      • style content with the CSS
      • or run JavaScript.

    How the oik-unloader plugin works

    • The oik-unloader plugin delivers a WordPress Must Use plugin called oik-unloader-mu.php.
    • This MU plugin uses a configuration file to determine which plugins to deactivate.
    • For each request it uses the current URL to decide which plugins should not be activated.
    • When WordPress is loading plugins it removes the selected plugins from the list.

    How to use the oik-unloader plugin

    You use the same process for each URL where you believe you can improve the server performance.

    Plugins box

    • From the WordPress admin menu choose Settings > oik unloader
    • If not already present type the New URL and press the Add URL button.
    • Use the URL select box to identify the URL to change and press Choose URL to update
    • Select the plugins to be deactivated using the checkboxes.
    • Press the Update plugins to deactivate button to apply your changes.
    • If you no longer need to improve the performance of an URL use the Delete URL button
    • Each time you perform an update the changes will be applied immediately.
    • Test the results by viewing the URL in another browser window or tab.
    • Note: You may need to clear a cache.

    oik-unloader-mu box

    Unlike many other MU plugins this one can be managed using the oik-unloader-mu box in Settings > oik-unloader

    To install the MU plugin choose the Click to activate/update MU link. The MU plugin can be uninstalled using the Click to deactivate MU link.

    Alpha testing oik-unloader on live sites

    So the question is, does the oik-unloader WordPress performance improvement plugin actually produce measurable results?

    I performed a number of tests to attempt to improve the performance of the home URL on some of my live sites.

    I measured the Server side response using my oik-bwtrace plugin, with requests being driven by, and results compared, using the Slog plugin. For more information see Does my site run slow with this?

    I used Lighthouse to measure the performance in the browser for both Mobile and Desktop.

    Server side response test

    The following charts shows the effect on server side response of deactivating a bunch of plugins on the home URL of oik-plugins.com and oik-plugins.co.uk, two sites with almost identical content.

    • Step 1 summarises the server response before the plugin is installed
    • Step 2 summarises the server response when the main plugin is installed
    • Step 3 summarises the server response when the MU plugin is installed
    • Step 4 summarises the server response when the selected plugins are deactivated

    Notes

    • I expect the results from step 4 to be better than for steps 1, 2 and 3.
    • If not there's something wrong.
    • I expect the results for step 1 to be marginally better than the results for step 2; in step 2 another plugin is activated.
    • Ditto for step 2's results to be marginally better than step 3, where the MU plugin is also being loaded.
    • With a small number of requests being measured the results can appear inconclusive.
    • I ran fewer requests on oik-plugins.com than I did on oik-plugins.co.uk
    • Even if step 4 is not obviously better than step 1, there is a still the chance of improved results in the Lighthouse tests due to there being a smaller payload, or fewer CSS and JavaScript files enqueued.
    • For oik-plugins.com I deactivated 33 plugins for step 4.
    • On oik-plugins.co.uk I deactivated 29.
    • Then I went a step further and deactivated Yoast SEO - step 4b
    • The chart indicates that Yoast SEO adds up to 0.03 of a second to each server response.
    • It's creating output intended for search engines and other websites that's hardly ever viewed by humans.

    Lighthouse performance tests

    Using the Lighthouse Chrome Extension I measured the Performance for both Mobile and Desktop.

    • Before is equivalent to step 1 - measuring the Performance before the plugin is installed
    • Installed is equivalent to step 2 or 3 - when the MU plugin is installed but no plugins are being dynamically deactivated
    • Configured is equivalent to step 4.

    We expect the Configured performance to be higher than the Before performance.

    Mobile

    Desktop

    Notes on running Lighthouse tests

    • Before running any Lighthouse performance test you should
      • Ensure that any cacheing is cleared and re-primed. This may need to be done from the hosting control panel.
      • Ensure that any tracing or logging is disabled.
      • Consider setting WP_DEBUG and SCRIPT_DEBUG constants to false.
    • It's best to run Lighthouse in an Incognito window.
    • Load the URL you want to visit. Check it looks and behaves how you expect it to look and behave.
    • Then run the Lighthouse tests, at least once for each of Mobile and Desktop, averaging the results.

    Comments on the results

    • In most cases I was able to achieve some improvement.
    • The detailed report often recommended image optimization - tip 3.
    • I attribute the very poor results for wp-a2z.org to Google Ads
    • I didn't run enough tests to get good average figures. I wouldn't have expected the Performance for Before and Installed to be any different.
    • Better results were harder to achieve on WordPress Multi Site ( oik-plugins.uk and wp-a2z ) due to current limitations of the plugin,

    Conclusions

    The initial results are promising.

    • Dynamically deactivating plugins that aren't needed can improve the server response time.
    • Dynamically deactivating plugins that aren't needed can improve the browser performance figure
    • When Lighthouse tests are already reporting 100 you might want to focus on improving the performance of other URLs
    • I need to do more work to support WordPress Multi Site better

    Next steps

    • Publish the plugin on oik-plugins.com.
      Done: Download the plugin from oik-unloader: deactivate plugins on demand
    • Add logic to support deactivation of Network Activated plugins in WordPress Multi Site.
    • For each site find a poor performing URL and attempt to improve the performance
    • Test the effect with multiple URLs
    • Test the effect with archive URLs
    • Find some slower sites to test and see how much improvement can be achieved.
    • Investigate options for varying the deactivation depending on the requester.
    • Remove the Google Ads from wp-a2z.org.
      Done: I removed the ads from the home URL.
    • Investigate using Lighthouse on the command line for performing repetitive tests.


    Published:

    Last updated:

    October 27, 2021

Categories

Tide times from tidetimes.co.uk

Tide Times & Heights for Langstone Harbour on
Tuesday, 07 December 2021
High Tide:01:09 ( 4.90m )
Low Tide:06:14 ( 0.90m )
High Tide:13:24 ( 4.80m )
Low Tide:18:38 ( 0.80m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
7th December 2021
01:22 High Tide ( 4.85m )
06:22 Low Tide ( 0.69m )
13:33 High Tide ( 4.83m )
18:48 Low Tide ( 0.57m )