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

Set maximum number of parsed CSS transients to store and proactively delete obsolete transients #5405

Closed
westonruter opened this issue Sep 19, 2020 · 3 comments
Labels
CSS Groomed Performance Punted WS:Perf Work stream for Metrics, Performance and Optimizer
Projects

Comments

@westonruter
Copy link
Member

Feature description

In a recent support topic, a user reported their wp_options table growing to 12GB and making queries very slow. Apparently this is due to transients being stored by the AMP plugin, in particular those for parsed stylesheets. A lot of work has been invested into mitigating this problem (#2092) by monitoring the average number of transients being generated over time period and disabling transient caching if the number goes above a given threshold (#4177). Apparently this is not working for the user who opened the support topic, as I can't imagine 12GB would not exceed the threshold in MonitorCssTransientCaching.

I have an idea to compliment MonitorCssTransientCaching as an additional safeguard. What if it not only detected the number of new transients being created each day, but if it also looked at the total number of transients stored for parsed stylesheets? If that number is ridiculously large (like 10,000) then we should consider disabling parsed CSS transient caching in this case as well.

Additionally, along with obtaining the current number of transients being stored, this background task can also proactively delete the transients for older versions of the plugin. Currently when the $cache_group is changed from say amp-parsed-stylesheet-v30 to amp-parsed-stylesheet-v31, all of the transients for amp-parsed-stylesheet-v30 will remain in the DB for up to a month. If there are multiple releases of the AMP plugin in a month, then this could result in the same parsed stylesheets being stored in multiple versions concurrently, even though we only need the most recent version. When the $cache_group is bumped in this case, all transients that have a name prefixed by amp-parsed-stylesheet-v30 can just be straight up deleted.

Putting in place a max transient count and proactively purging old versions of transients should guard against the database getting filled up and slowing down the site.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation brief

QA testing instructions

Demo

Changelog entry

@westonruter westonruter added CSS Performance WS:Perf Work stream for Metrics, Performance and Optimizer labels Sep 19, 2020
@westonruter westonruter added this to Backlog in Ongoing via automation Sep 19, 2020
@westonruter
Copy link
Member Author

cc @schlessera

@westonruter westonruter added this to the v2.1 milestone Oct 14, 2020
@westonruter
Copy link
Member Author

Note that delete_expired_transients() will delete expired transients without accessing them. This happens on a daily cron.

@westonruter
Copy link
Member Author

On a parsed CSS version bump, we should delete old transients. Otherwise, with each version bump we will double the number of transients until they expire.

@kmyram kmyram added the Groomed label Oct 27, 2020
@westonruter westonruter modified the milestones: v2.1, v2.2 Feb 11, 2021
@westonruter westonruter removed this from the v2.2 milestone Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Groomed Performance Punted WS:Perf Work stream for Metrics, Performance and Optimizer
Projects
Ongoing
  
Backlog
Development

No branches or pull requests

2 participants