[wp-trac] [WordPress Trac] #60457: Plugin Dependencies: Running update_option within wp-settings can be catastrophic for a high traffic site

WordPress Trac noreply at wordpress.org
Wed Feb 7 07:35:41 UTC 2024


#60457: Plugin Dependencies: Running update_option within wp-settings can be
catastrophic for a high traffic site
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Plugins       |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:  performance   |
--------------------------+-----------------------------
 In #22316 the following code was added for plugin dependencies:
 https://github.com/WordPress/wordpress-
 develop/blob/27087b71e0c109af68dbc0545893217fc80350db/src/wp-
 settings.php#L597-L599

 Running DB Writes, particularly `update_option()` on the front-end,
 especially during the bootstrap of WordPress can have catastrophic
 consequences when thousands of requests all try to update the database and
 cache at the same time.

 This leads to a much higher chance of the Database and Cache becoming out-
 of-sync, which can cause snowballing issues. This happened on
 api.WordPress.org/plugins today, with WordPress getting stuck in a
 situation where it constantly tried to update the DB and failed (because
 the data had already been written there, but the cache said otherwise) and
 as a result never properly updated the cache.

 Additionally; Loading a large option of all plugin headers during the
 WordPress bootstrapping is rather expensive, in the whole scheme of
 things, especially when only a few fields are actually used.
 On WordPress.org/plugins this has become a 75KB blob of data of which
 exactly 0bytes are used, loaded on every page load and API request, that
 has to be fetched from either the Database or the Object cache.

 Perhaps the dependency checking shouldn't be done at inclusion time, but
 rather as part of the activation/update process for plugins.[[BR]]
 This has the benefit that it moves the processing away from happening on
 each page load and only on requests that are able to process more data
 without affecting the end-user, or site performance, and functionalities
 such as fetching the plugin headers doesn't strictly need to be cached.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60457>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list