[wp-trac] [WordPress Trac] #54221: _transient_dirsize_cache is set to autoload=yes and kills db performance if it grows (20MB in our case)

WordPress Trac noreply at wordpress.org
Fri Oct 7 22:07:33 UTC 2022


#54221: _transient_dirsize_cache is set to autoload=yes and kills db performance if
it grows (20MB in our case)
--------------------------+------------------------------------------
 Reporter:  archon810     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Future Release
Component:  Database      |     Version:  2.8
 Severity:  major         |  Resolution:
 Keywords:  needs-patch   |     Focuses:  administration, performance
--------------------------+------------------------------------------

Comment (by flixos90):

 @iandunn @SergeyBiryukov Acknowledging that the size of this transient is
 a problem, my take here would be that the even larger issue is that it is
 being autoloaded, thus affecting every basically every request.

 How about we break the work into two parts?
 1. Change the autoload behavior so that this value is not autoloaded. That
 could happen as part of this ticket, since that is also the primary point
 of the ticket based on the title.
 2. Open a separate ticket to further explore how the calculation can be
 optimized.

 For 1.: How about we change `set_transient()` to determine the autoload
 value based on a certain threshold of the value? I'm not exactly sure
 which value that should be, but I think it's fair to say that once a value
 goes beyond a certain threshold in size, it should never be autoloaded as
 it would notably slow down that entire query.

 > Related: #55969 would add an `$autoload` param to `set_transient()`.

 I would advise against this for now. While today this could be useful,
 options and transients misusing (or probably, for the most part,
 developers not thinking about) autoloading and what that means is a large
 problem in general. We are currently exploring an overhaul of that entire
 approach via https://github.com/WordPress/performance/issues/526, and part
 of that would potentially be to deprecate that parameter. Probably the
 biggest mistake with it was that it's optional - resulting in many people
 to ignore it and maybe not even knowing it exists. Anyway, long story
 short, I'm not convinced adding that parameter to `set_transient()` is the
 right answer.

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


More information about the wp-trac mailing list