Skip to content
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

Google fonts; avoid too big transients when loading fonts #28119

Closed
simison opened this issue Dec 30, 2022 · 1 comment
Closed

Google fonts; avoid too big transients when loading fonts #28119

simison opened this issue Dec 30, 2022 · 1 comment
Labels
[Feature] Google Fonts [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Comments

@simison
Copy link
Member

simison commented Dec 30, 2022

Impacted plugin

Jetpack

What

Google Fonts module requests and caches all the fonts in one request, which might fail.

How

Part of #28118

Fonts API gets requested in backend in one big request, then cached, and returned styles are inlined at the site, both at the wp-admin and frontend of the site.

Admin side requests all the fonts (including weights 100—900 and styles) in one request, instead of requesting them gradually. At frontend fewer fonts are typically added, depending on how many were used to design the site.

When there are too many fonts, this results in over 10mb transients which fails. This happened when we started again adding more fonts (one, two) and request just grew too big. (See p1672355026291499-slack-jetpack)

Potential solutions:

  • Split the request into multiple batches (good first remedy!).
  • Add CSS minification to the API (pMz3w-g6E-p2s/#comment-104697), saves about ~20% kbs when caching
  • Instead of loading from the fonts API in the backend, caching the response, and in-lining the styles, consider just requesting fonts API directly by client and let normal browser caching do the job.
@simison simison added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] Google Fonts labels Dec 30, 2022
@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Dec 30, 2022
@simison
Copy link
Member Author

simison commented Nov 13, 2024

These APIs are deprecated longer ago already.

@simison simison closed this as completed Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Google Fonts [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

No branches or pull requests

1 participant