Changes between Initial Version and Version 2 of Ticket #32474
- Timestamp:
- 05/24/2015 01:03:23 AM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #32474 – Description
initial v2 1 Widget instance data has always been stored in `wp_options`. This worked fine when there were only a few widgets used on a site. When there are hundreds—or thousands—there are big performance problems. When initializing widgets, Core loads the entire settings arrays of all widgets even when they are not used (#23909). Additionally, widget settings options are by default autoloaded: this means that for widget-heavy sites using Memcached Object Cache will reach the 1MB limit and crash since the autoloaded options will no longer be cacheable (WordPress.com even [https://github.com/Automattic/vip-quickstart/blob/master/www/wp-content/mu-plugins/alloptions-limit.php block a site from loading] in this scenario). Storage in autoloaded options also means widgets are susceptible to alloptions cache corruption (#31245). Bottom line: widgets stored in options are not scalable.1 Widget instance data has always been stored in `wp_options`. This worked fine when there were only a few widgets used on a site. When there are hundreds—or thousands—there are big performance problems. When initializing widgets, Core loads the entire settings arrays of all widgets even when they are not used (#23909). In the Customizer, changes to widget settings is very expensive due having to unserialize and serialize option arrays repeatedly (#32103). Additionally, widget settings options are by default autoloaded: this means that for widget-heavy sites using Memcached Object Cache will reach the 1MB limit and crash since the autoloaded options will no longer be cacheable (WordPress.com even [https://github.com/Automattic/vip-quickstart/blob/master/www/wp-content/mu-plugins/alloptions-limit.php block a site from loading] in this scenario). Storage in autoloaded options also means widgets are susceptible to alloptions cache corruption (#31245). Bottom line: widgets stored in options are not scalable. 2 2 3 3 As I've [https://core.trac.wordpress.org/ticket/31436#comment:2 mentioned elsewhere], widgets should ideally be stored in posts instead of options. In addition to improving the performance problems above, there are many advantaged to storing widgets as posts, including user attribution via `post_author`, revision history, import/export, querying, widget drafts, scheduled widgets, etc.