[wp-trac] [WordPress Trac] #31792: register_uninstall_hook() causes large amounts of unnecessary updates to wp_options (was: register_uninstall_hook causes large #s of unnecessary updates to wp_options)

WordPress Trac noreply at wordpress.org
Thu Mar 14 15:47:56 UTC 2019


#31792: register_uninstall_hook() causes large amounts of unnecessary updates to
wp_options
-------------------------------------------------+-------------------------
 Reporter:  jeichorn                             |       Owner:  jorbin
     Type:  defect (bug)                         |      Status:  reopened
 Priority:  normal                               |   Milestone:  Awaiting
                                                 |  Review
Component:  Options, Meta APIs                   |     Version:
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch needs-testing bulk-        |     Focuses:
  reopened                                       |  performance
-------------------------------------------------+-------------------------
Changes (by tha_sun):

 * keywords:  has-patch, needs-testing, bulk-reopened => has-patch needs-
     testing bulk-reopened
 * focuses:   => performance


Comment:

 I can confirm that this is still a problem.  Excessive write and delete
 operations are not a problem when looking at them in isolation, of course.
 But they do become a problem with increased concurrency (server responds
 to many parallel requests).  And if the site uses an external (object)
 cache, it causes a higher latency and longer processing queues, up to a
 point where the additional data traffic nulls the effect of the cache.

 **Rule of thumb:** GETting a page anonymously must only be a read
 operation internally. (idempotence)

 As the API function is used by a lot of plugins, it does not appear
 feasible to follow the path of fixing the calling code.  Instead, we
 should fix the API function to be smarter.

 In particular, the function can simply check the currently stored option
 value before writing the same value again.  This ensures that new values
 are picked up immediately, while the API stays the same and regular page
 views does not perform a write operation.

 Attached patch implements that.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/31792#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list