Autoloaded Data over 1MB causes a performance hit
-
Howdy!
First of all, thanks for your work on this plugin!
We’ve been using this plugin and it works great for most cases, but we’ve noticed a problem with sites that contain a large amount of autoloaded data in the wp_options table.
My understanding of this is as follows:
Normally when WordPress performs a query, it can save the result of that query in the database as a “transient” to avoid having to run the same expensive query multiple times.
https://developer.www.ads-software.com/apis/handbook/transients/
This plugin steps in and stores those “transients” into memcached (RAM) instead of in the database since reading from memory is much faster than having to read from DB on the disk.
The problem is that memcached has a hard limit of 1MB for storing values and this plugin doesn’t fallback to storing as a database transient. If the result of a query is greater than 1MB, memcached cannot store it – it is not saved for later and must be re-run every time.
Values in the wp-options table with the
autoload
value set toyes
, will be included in near every query that the site performs. Usually this should just be limited to the essentials like site URL, etc. Some plugins may bloat the autoload values until they are approaching the 1MB limit which causes the problems mentioned above.If autoloads are above 1MB, then nothing can be stored in memcached. If autoloads are at 800K, then 200K of additional query result can be stored along with it, etc.
This will typically end up causing degraded performance for these sites rather than speeding them up, manifesting as high CPU usage via MySQL and a spike in load, CPU usage and possibly disk I/O.
Ideally, this plugin should be able to fall back to storing any result > 1MB to the normal transients table, then when fetching a result, check memcached first, else fall back to transients, etc.
- The topic ‘Autoloaded Data over 1MB causes a performance hit’ is closed to new replies.