WordPress.org

Make WordPress Core

Opened 2 months ago

Last modified 2 months ago

#54423 new enhancement

Add Site Health test for full page caching (advanced cache)

Reported by: westonruter Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Site Health Keywords: needs-docs
Focuses: performance Cc:

Description

A best practice for performance is to enable full page caching for a WordPress site. Doing so reduces the time to first byte (TTFB) and thus directly impacts Core Web Vitals. This is especially important on shared hosts which have limited compute power, while also protecting a site from going down due to traffic spikes.

As with XML Sitemaps, it may make sense for WordPress core to include a basic full page caching solution out of the box which can be extended by the many plugins that provide page caching today. In the meantime, there should at least be a Site Health test with a low-severity recommended status to point users to where to go to enable page caching. Since hosts often have built-in caching solutions in place, the Site Health test should be easily filterable so they can provide a link to their specific dashboard or documentation to enable caching which may not be a plugin at all but rather a reverse proxy like Varnish.

In the context of the AMP plugin for WordPress, we've already developed such a test which could be adapted for core. See amp-wp#6456. It's an async test which issues three loopback requests to the homepage, and the test will pass if responses include either of the following headers:

  1. Cache-Control with non-zero max-age.
  2. Expires with a future time.
  3. Age with a positive number (as is set via a proxy like Varnish).

Change History (3)

#1 @westonruter
2 months ago

  • Summary changed from Add Site Health test for page caching (advanced cache) to Add Site Health test for full page caching (advanced cache)

#2 in reply to: ↑ description @SergeyBiryukov
2 months ago

Replying to westonruter:

As with XML Sitemaps, it may make sense for WordPress core to include a basic full page caching solution out of the box which can be extended by the many plugins that provide page caching today.

Not the same as full page caching, but might be relevant for reference: persistent object caching was previously included in [3011] and removed in [6539] / #5570 due not not being actively maintained.

#3 @Clorith
2 months ago

  • Keywords needs-docs added

I think this is a viable check to add in, both for page caches, but I could see other caching as well, perhaps a test for caching in general is the way to go, always on the "Recommended" level, but checks for both page and object caches, could even check if static assets have some form of cache headers?

The prerequisite for all of this is that we need user documentation ready on WordPress.org before any of this lands in core though (we probably should have for all of these things regardless of this enhancement landing, so flagging it down for the docs team to have a look at as well). There are some docs already at https://make.wordpress.org/hosting/handbook/performance/ but it is a bit of a catch-all, so perhaps it needs its own performance category and split out a little? (but that's for docs to know better than I how the users interact with these areas :) )

Note: See TracTickets for help on using tickets.