Proposal: Persistent Object Cache and Full Page Cache Site Health Checks

This proposal seeks to integrate two new Site Health checks for Persistent Object Cache and Full Page Cache into WordPress coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress., targeting the WordPress 6.1 release.

Context

Providing valuable recommendations for site owners is crucial to improving WordPress performance. These two modules are the first in a series of Site Health modules that the performance team is working on. Acknowledging performance problems is the first step to solving them.

The modules were originally proposed and developed by members of the performance team and are available as modules inside the Performance Lab plugin.

Project update

Development of the features has been ongoing in the Performance Lab plugin repository on GitHub, where they have been implemented as: 

The recently released version 1.2.0 of the Performance Lab plugin contains both modules in a state that is ready to merge into core. 

The team is currently migrating the module code into WordPress core patches in 2 TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress. tickets:

  • Persistent Object Cache Health Check from performance pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party to core (#56040)
  • Port Audit Full Page Cache from performance plugin to core (#56041)

Any reviews and feedback on the core patches would be greatly appreciated.

Customizing the audits

We’ve added a series of filters to make messaging and suggestions customizable. These filters can be used by hosting providers to provide their own personalized suggestions on how to address the Site Health feedback.

Persistent Object Cache filters

Hosts may want to replace the notes to recommend their preferred object caching solution:

apply_filters( 'site_status_persistent_object_cache_notes', $notes, $available_services );

Hosts may want to replace the original link to WordPress documentation with a link to  their own guide:

apply_filters( 'site_status_persistent_object_cache_url',  __('https://wordpress.org/support/article/optimization/#object-caching' ));

Hosts or site owners may want to bypass thresholds and force suggestions, or filterFilter Filters are one of the two types of Hooks https://codex.wordpress.org/Plugin_API/Hooks. They provide a way for functions to modify data of other functions. They are the counterpart to Actions. Unlike Actions, filters are meant to work in an isolated manner, and should never have side effects such as affecting global variables and output. them to determine whether to suggest the use of a persistent object cache:

apply_filters( 'site_status_suggest_persistent_object_cache', false );
apply_filters(
    'site_status_persistent_object_cache_thresholds',
    array(
        'alloptions_count' => 500,
        'alloptions_bytes' => 100000,
        'comments_count'   => 1000,
        'options_count'    => 1000,
        'posts_count'      => 1000,
        'terms_count'      => 1000,
        'users_count'      => 1000,
    )
);

Full Page Cache filters

Developers can filter the threshold below which a response time is considered good:

apply_filters( 'page_cache_good_response_time_threshold', 600 );

Testing and feedback

You can test the modules in v1.2.0 or later of the Performance Lab plugin. Both modules should be enabled by default, but you can double-check that they are enabled in Settings > Performance:

Once enabled, you can view the test results on the Site Health Status screen at Tools > Site Health > Status.

We encourage you to test these modules (and others) from the Performance Lab Plugin, report any bugs in our GitHub repository, or contribute with fixes and ideas. You can also share any feedback, concerns, or questions to improve these features further in the comments.

Thanks to @mxbclang and @flixos90 for peer review.

#6-1, #core-site-health, #performance, #performance-lab, #site-health