10up / 10up-experience

The 10up Experience plugin configures WordPress to better protect and inform clients, aligned to 10up’s best practices.
GNU General Public License v2.0
129 stars 27 forks source link

Autoloaded or big options can be problematic for Redis/Memcache object caches #138

Closed tott closed 10 months ago

tott commented 1 year ago

Describe the bug

We ran into an issue with a client who had define('SUPPORT_MONITOR_DEBUG' , true); and when they saw an increase in traffic this pushed our Redis servers to their bandwidth limits.

The reason for this is that the tenup_support_monitor_log option grew to around 5MB and was autoloaded, causing it to be part of the alloptions cache which is requested frequently. We switched this option to not be autoloaded any longer and disabled the debug setting for now but it would be good to review all options that are being used (especially the ones which can grow large) and ensure they are not autoloaded (the default for new options when the autoload parameter is omitted when setting the option).

This particular option is set here https://github.com/10up/10up-experience/blob/14c8794c9c9b34764fa379c45d9112045db03ff4/includes/classes/SupportMonitor/Debug.php#L196

Furthermore, I would suggest truncating this option to not exceed 1 MB in (serialized) size as otherwise, this can have ill effects on common memcache setups which have a SLAB size of 1 MB.

Steps to Reproduce

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct