-
Notifications
You must be signed in to change notification settings - Fork 100
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
Default to network-first caching strategy #265
Comments
Thanks to @rviscomi, we have some data from HTTP Archive on how many assets are added to WP pages from themes, plugins, and core:
SELECT
percentile,
path,
APPROX_QUANTILES(freq, 1000)[OFFSET(percentile * 10)] AS freq
FROM (
SELECT
page,
REGEXP_EXTRACT(url, r'/(themes|plugins|wp-includes)/') AS path,
COUNT(0) AS freq
FROM
(SELECT url AS page FROM `httparchive.technologies.2020_09_01_mobile` WHERE app = 'WordPress')
JOIN
(SELECT pageid, url AS page FROM `httparchive.summary_pages.2020_09_01_mobile`)
USING
(page)
JOIN
(SELECT pageid, url FROM `httparchive.summary_requests.2020_09_01_mobile`)
USING
(pageid)
GROUP BY
page,
path
HAVING
path IS NOT NULL),
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
path
ORDER BY
percentile,
path So this being said, it appears the default
|
Whereas the above indicates the asset counts for plugins, themes, and core. What follows is the byte site of the assets in those categories (in KB):
This is also courtesy of @rviscomi. SELECT
percentile,
path,
APPROX_QUANTILES(kbytes, 1000)[OFFSET(percentile * 10)] AS kbytes
FROM (
SELECT
page,
REGEXP_EXTRACT(url, r'/(themes|plugins|wp-includes)/') AS path,
SUM(respSize) / 1024 AS kbytes
FROM
(SELECT url AS page FROM `httparchive.technologies.2020_09_01_mobile` WHERE app = 'WordPress')
JOIN
(SELECT pageid, url AS page FROM `httparchive.summary_pages.2020_09_01_mobile`)
USING
(page)
JOIN
(SELECT pageid, url, respSize FROM `httparchive.summary_requests.2020_09_01_mobile`)
USING
(pageid)
GROUP BY
page,
path
HAVING
path IS NOT NULL),
UNNEST([10, 25, 50, 75, 90, 100]) AS percentile
GROUP BY
percentile,
path
ORDER BY
percentile,
path So if we go with the 75th percentile for
|
The Basic Site Caching plugin contains what have turned out to be the most common baseline caching strategy for sites. In particular, a network-first caching strategy ensures that the freshest content is served when connected to the network with fallbacks for to the cache when the network fails
This is the required code:
A network-first caching strategy is then also needed for the scripts and styles that a site depends on (coming from core, themes, and plugins). See #264.
A cache-first strategy would also make sense for uploaded files:
Note that this does not currently account for uploaded files that are hosted on an external CDN, so that should be accounted for as well.
I think this should be the default behavior of the plugin, of course allowing a site to override the default behavior with the filters. Then the PWA plugin would provide for more than just an offline page out of the box. This will in part make #176 obsolete.
The text was updated successfully, but these errors were encountered: