[wp-trac] [WordPress Trac] #62692: Performance regression for get_option in 6.4

WordPress Trac noreply at wordpress.org
Sat Dec 14 05:20:35 UTC 2024


#62692: Performance regression for get_option in 6.4
--------------------------------------+------------------------------
 Reporter:  rmccue                    |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Cache API                 |     Version:  6.4
 Severity:  major                     |  Resolution:
 Keywords:  has-patch has-unit-tests  |     Focuses:  performance
--------------------------------------+------------------------------

Comment (by ivankristianto):

 I have run some testing on my local and compare the code before and after
 the revert patch.

 Before the patch:


 {{{
 >> wp cache flush
 Success: The cache was flushed.

 >> wp shell --url=<site-url>
 > global $wp_object_cache
 > $wp_object_cache->redis_calls;
 = [
     "get" => 182,
     "set" => 198,
   ]

 > get_option('home')
 = "<site-url>"

 > $wp_object_cache->redis_calls;
 = [
     "get" => 182,
     "set" => 198,
   ]

 > get_option('something_not_exists')
 = false

 > $wp_object_cache->redis_calls;
 = [
     "get" => 183,
     "set" => 199,
   ]

 > get_option('something_not_exists')
 = false

 > $wp_object_cache->redis_calls;
 = [
     "get" => 184,
     "set" => 199,
   ]

 > get_option('something_not_exists')
 = false

 > $wp_object_cache->redis_calls;
 = [
     "get" => 185,
     "set" => 199,
   ]
 }}}

 After the revert patch:


 {{{
 >> wp cache flush
 Success: The cache was flushed.

 >> wp shell --url=<site-url>
 > global $wp_object_cache
 > $wp_object_cache->redis_calls;
 = [
     "get" => 99,
     "set" => 198,
   ]

 > get_option('home')
 = "<site-url>"

 > $wp_object_cache->redis_calls;
 = [
     "get" => 99,
     "set" => 198,
   ]

 > get_option('something_not_exists')
 = false

 > $wp_object_cache->redis_calls;
 = [
     "get" => 100,
     "set" => 199,
   ]

 > get_option('something_not_exists')
 = false

 > $wp_object_cache->redis_calls;
 = [
     "get" => 100,
     "set" => 199,
   ]

 > get_option('something_not_exists')
 = false

 > $wp_object_cache->redis_calls;
 = [
     "get" => 100,
     "set" => 199,
   ]
 }}}

 The above is the experiment to proof the concept Ryan's said here:

 > To replicate this, call get_option( 'notexist' ) in a loop. Prior to
 6.4, this would generate 2 total cache gets; after 6.4, it generates an
 infinite number, as each iteration of the cycle triggers a cache get which
 misses.

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


More information about the wp-trac mailing list