-
Notifications
You must be signed in to change notification settings - Fork 106
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
Detection time window may not allow enough URL Metrics to be collected #1496
Comments
Related is a conversation @westonruter and I had at WordCamp US: To reliably handle dynamic behavior on the client-side, the behavior needs to be controlled by the client-side, to account for full page caches which will lead to most requests not to reach the PHP logic. This basically means two things:
Defining the right solution for this probably goes beyond this issue, maybe we should open a new one, that is more broadly about how to support full page caches in a way that the Optimization Detective functionality is still reliable? I think prioritizing this will be crucial to get broader adoption, as lots of sites use a full page cache which will affect the behavior negatively - sometimes minor, sometimes more severely, depending on the cache configuration. |
Here is a table for what I've found the default max-age to be for caching plugins:
|
I've been tackling this problem in the following sequential PRs:
The first two remove what is specifically broken with page caching: nonces and the detection time window. The third begins to proactively address the problem of a page caching plugin holding onto an unoptimized cached page even after URL Metrics have been submitted by visitors and the corollary problem of the inline script data not being up-to-date. By ensuring that page caching plugins flush the caches for cached URLs which have updated URL Metrics, then we can actually rely on the inline script to be relatively up-to-date on the needs for URL Metrics. We may not need to move the |
Ideas discussed with @felixarntz:
I just looked at LightSpeed Cache and they purge caches in response to the |
I've filed #1655 to address the points raised in #1496 (comment). |
Originally in #1494 (comment).
I discovered on my blog that I had a very old URL Metric from before the XPath indices were fixed to be 1-based instead of 0-based (#1191). Looking at the URL Metric data, I see the timestamp is
1712354502.752218
which is for a day back in April. It appears that URL Metrics are not being collected frequently enough, or my site is truly devoid of traffic. I think for my site it may be in part due to page caching, where the detection time window (od_detection_time_window
) is too short, so it is only collecting metrics for visitors who happen to visit when there is a MISS to the page cache, and if there is a stale-while-revalidate caching strategy going on with Varnish then it is even more likely for the visitor to never be within the detection time window (currentTime - serveTime > detectionTimeWindow
):performance/plugins/optimization-detective/detect.js
Lines 179 to 187 in f8dad34
I think this logic needs to be revisited.
The text was updated successfully, but these errors were encountered: