Viewing 5 replies - 1 through 5 (of 5 total)
  • We’d be happy to look into this for you. In order to investigate your current setup can you share your Site Health info using this form?

    Plugin Author Weston Ruter

    (@westonruter)

    I understand the issue is the amp-parsed-stylesheet transients?

    When the AMP plugin encounters a stylesheet it hasn’t encountered before, it parses the stylesheet and stores the parsed representation in a transient. This is to avoid having to parse it again, as the parsing is computationally intensive. The stylesheet needs to be parsed in order to validate it and also in order to perform tree shaking so that the AMP plugin can remove unused CSS to bring the total under the 75KB limit.

    So the fact that there are amp-parsed-stylesheet transients is normal. What is not normal is that there are so many. Can you do a count for the number of such rows? For example:

    SELECT COUNT(*) FROM wp_options WHERE option_name LIKE '_transient_amp-parsed-stylesheet%'

    You can also determine the amount of storage used by these rows for example:

    SELECT SUM(LENGTH(option_value)) FROM wp_options WHERE option_name LIKE '_transient_amp-parsed-stylesheet%';

    Apparently this should be something large like 1000000000.

    One possible cause is for stylesheets being highly variable. If a stylesheet changes at all, then that causes a new transient to be added. We did a bunch of work to try to catch this situation and turn off caching parsed stylesheets in that case, to prevent filling up the DB. See https://github.com/ampproject/amp-wp/issues/2092

    If you go into your Site Health, is there any AMP test being reported for transient caching of parsed stylesheets being disabled?

    Plugin Author Weston Ruter

    (@westonruter)

    The fast way to clear out all those entries is just to flush all the transients. You can do this in WP-CLI via wp transient delete --all.

    After you do that, you can then monitor transient growth over time to see if it rapidly grows again.

    Plugin Author Weston Ruter

    (@westonruter)

    In addition to ensuring stylesheets aren’t highly variable, another way to prevent this from happening in the future is to just switch to using a persistent object cache, like Redis or Memcached. Then no transients will be stored in the wp_options table at all.

    Plugin Author Weston Ruter

    (@westonruter)

    I wonder: Is WP Cron working properly for you? I should have thought that the work done in #4177 would have stopped parsed stylesheets from being stored in transients since the number appears to be very high.

    Please check your Site Health to see if there is any test failure for WP Cron.

    While you’re at it, pleases submit your Site Health info to us via our submission form. This will have helpful information to assist us with helping you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘This plugin inserted a lot of data in the wp_options table.’ is closed to new replies.