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.
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.
Done, SQL sent via Slack
Regards.
@jorgeocampo can you clean all transients and then check after a couple days to see how many have been created?
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.
See https://github.com/ampproject/amp-wp/issues/2092 for how the plugin could be improved to detect this scenario.
@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.
(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%";
Our install/DB crashes when that command runs (I also tried via SSH).
Already looking for another method, any ideas are very welcome @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.