-
Notifications
You must be signed in to change notification settings - Fork 383
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encourage use of page caching #4386
Comments
At a minimum we can link to https://make.wordpress.org/hosting/handbook/handbook/performance/#full-page-cache |
Additional inquiry:
|
I think so, but it would be a unique heuristic for each host. On Pantheon, for example, the test would be
Yes, it is |
Perhaps my intention to do host detection is a hopeless/brittle effort, and we should just provide general guidance but have a filter which hosts could use to direct users to docs that are specific to their hosting scenario . Something that was brought up is the case of hosts that do whitelabel reselling, where it would be bad if the underlying host was mentioned in the instructions. The default guidance could have a link to a page on amp-wp.org that privides the host-specific instructions as well as general instructions. |
See also #6432, where we can detect cache varying by mobile user agents to determine if we can default to server-side redirection. |
Note that if we detect page caching is enabled, we'll need to instruct the user to flush the cache after changing the template mode. See #4843. |
@westonruter and @dhaval-parekh I've started going through this and want to make sure I understand the flow. Following is a diagram showing the statuses and actions I imagine could exist:
|
Thanks for the diagram. We won't be able to reliably know whether the host includes the option for object caching or page caching. So we can't direct the user to where to go. When we provide provide a list of possible plugins to use, we'll also need to indicate that they should contact their host for the best option(s). As for compatibility, that will be a bit tricky to detect. If not using a caching plugin, then we won't be able to detect what is being used (as it is in another layer of the network stack). If it is a caching plugin, we could check to see if they have one of the specific plugins we've tested and if not, mention that we haven't tested with that plugin. But perhaps it's better to initially just say, “We've detected you have page caching enabled. If you're experiencing any issues, please refer to our guide.” |
Yes. That looks right. In both cases, we'll end up linking them off to our guide. What will differ between the two paths is the status of the check, whether it is a PASS or FAIL.
I missed this. The flow is essentially the same, although it is much simpler to detect whether object caching is implemented. We already have that implemented. What's missing is the recommended plugins, based on what capabilities their server has (e.g. Redis, Memcached, etc). |
Hey @westonruter, I'm working on the UI for this and in regards to your comment:
I went ahead and created this and wanted to know your thoughts about this. |
I'll note that the updated logic for detecting page caching is being made more robust in #6456 so we don't have to rely on Note there is an existing such button for another Site Health test for the stylesheet transient caching: |
Yeah, looks good to me. |
I've also proposed this Site Health test for core: https://core.trac.wordpress.org/ticket/54423 |
Feature description
The post processor cache was removed in #4178 due to being ineffective.
Instead of a post-processor cache, the AMP plugin should instead be detecting whether the site has page caching enabled. Having page caching (and object caching) is essential for any WordPress site that needs to scale. Whether this be provided by a plugin like WP Super Cache or a reverse proxy layer like Varnish, the AMP plugin should be detecting whether page caching is enabled, and if not, direct the user to the best page caching solution for their environment.
For some hosts, the solution is just to turn on page caching in the dashboard. For other environments, it is recommending a plugin based on whether a persistent caching service is available (e.g. Memcached or Redis). For others, it's whether some PHP extension is available (e.g. APCu).
See also #1216 for host-specific instructions for object caching.
This will involve evaluating caching plugins for AMP compatibility so we can direct users to install ones that we know will work properly.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
-- General information in terms of caching approaches and associated plugins
-- General information about caching services provided by hosting services
-- Provide a filter that hosting providers can leverage
hydrate
the general guidanceDesign
Implementation brief
For detection of page caching, one solution is to explicitly check for specific plugins being active and configured to enable page caching. This is feasible although tedious. Nevertheless, it won't help if there is an external caching layer in the network stack (e.g. Varnish). Therefore, a more general approach to detect page caching being enabled would be:
template_redirect
hook which short-circuits with printingwp_rand()
when a given query parameter is present.fetch
request without credentials to that URL 3 times (or more). Beware of hosts that will interpret this as DDoS attack.The results should then be displayed in Site Health.
QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: