• Resolved Jorge Ocampo

    (@jorgeocampo)


    It looks like my database is being spammed very hardly by AMP plugin. It’s creating an enormous number of transients in wp_options table. Right now it contains almost 6.000.000 records (!!!).
    https://jmp.sh/3hBUfSa
    https://jmp.sh/OI4id2F

    I believe that it’s a very serious problem and my site might even crash soon because of this issue.
    🙁

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Weston Ruter

    (@westonruter)

    The quickest fix is for you to enable a persistent object caching plugin, backed Memcached or Redis. The two I have used are:

    https://wordpress.org/extend/plugins/memcached/
    https://wordpress.org/plugins/wp-redis/

    Your host would have to provide these services.

    Plugin Author Weston Ruter

    (@westonruter)

    Note that a transient is created for each image that lacks width/height attributes, as it has to fetch the image to determine the dimensions and then store them in a transient.

    Transients are also created for parsed stylesheets. I’m seeing more than the expected number of stylesheets in your screenshot. Would it be possible to send me an export of the transients on WordPress Slack? It could be that there is a bug and I want to examine it.

    Thread Starter Jorge Ocampo

    (@jorgeocampo)

    Done, SQL sent via Slack
    Regards.

    Plugin Author Weston Ruter

    (@westonruter)

    @jorgeocampo can you clean all transients and then check after a couple days to see how many have been created?

    Plugin Author Weston Ruter

    (@westonruter)

    On my local development environment I only have 40 such transients _transient_%amp-parsed-stylesheet-v%:

    select count(*) from wp_options where option_name like '_transient_%amp-parsed-stylesheet%' and option_name not like '_transient_timeout_%';

    For the SQL dump you gave me, there are almost a million such entries.

    The transient count goes up by one every time I modify a stylesheet to have a new value not before seen.

    In looking at your CSS actually, this would seem to indicate what the problem is. I’m seeing a lot of rules with class names td_uid_1_5c82894a1a5a7_rand. Using user IDs and random values in class names will cause the behavior you are reporting. The cached parsed CSS is never used again because the CSS is never encountered again.

    So if you eliminate the random class names from your CSS, then this should fix the issue for you.

    Plugin Author Weston Ruter

    (@westonruter)

    See https://github.com/ampproject/amp-wp/issues/2092 for how the plugin could be improved to detect this scenario.

    Thread Starter Jorge Ocampo

    (@jorgeocampo)

    @westonruter, cleaning all transients breaks my install almost completely. I’m not even able to open MySQL after the command is run via SSH
    Using a plugin is also not an option (timeout error)
    Do you have any suggestions?
    I not experienced enough.

    Plugin Author Weston Ruter

    (@westonruter)

    (Disclaimer: Run SQL commands at your own risk.)

    You can delete all AMP-specific transients with a SQL command like this:

    DELETE FROM wp_options WHERE option_name LIKE "%transient%" AND option_name LIKE "%amp%";

    Thread Starter Jorge Ocampo

    (@jorgeocampo)

    Our install/DB crashes when that command runs (I also tried via SSH).
    Already looking for another method, any ideas are very welcome @westonruter !!

    Plugin Author Weston Ruter

    (@westonruter)

    Sorry, that’s the only suggestion I have. Deletion of the transients is what needs to be done. You may need to change something in MySQL to get it to allow the command to run without crashing. I’m not an expert on that however.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘database is being spammed very hardly by AMP plugin’ is closed to new replies.