WordPress-Hosting-Best-Practices-Documentation icon indicating copy to clipboard operation
WordPress-Hosting-Best-Practices-Documentation copied to clipboard

wp_options: autoload — performance and memory use

Open pdclark opened this issue 6 years ago • 1 comments

Re: https://github.com/ataylorme/WordPress-Hosting-Best-Practices-Documentation/pull/35#discussion_r201106099

"Consider talking about autoload and Memcached" / "can we move this to an issue and get rid of inline TODO comments?"

Discuss wp_options autoload setting. Considerations on performance (query time) and memory use (PHP and object cache memory limits vs. MySQL longtext memory limits)

For example:

  • update_option(), autoload defaults to yes|true
  • When autoload is yes, wp_load_alloptions() loads these values into memory, either from MySQL or from object cache
  • Without object cache, each WordPress page load runs a query of wp_options, loading all autoload options into memory from MySQL.
  • With object cache (memcached, redis, APCu, etc.), wp_load_alloptions() should persist data across page loads.
  • Hosts: Consider maximum memory available for all combined options.
  • Developers: Consider benefits of having options cached by default (no additional SQL queries), vs. loading values into RAM on all page loads. Is the value likely to be used on every page load? If not — it may be fine to set autoload to false, allowing the value to be cached by MySQL, another cache, etc.

pdclark avatar Jul 17 '18 16:07 pdclark

I like this.

getsource avatar Jul 27 '18 23:07 getsource