[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
Tue Oct 24 08:31:06 UTC 2023


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

Comment (by vimalroy08):

 Replying to [comment:53 spacedmonkey]:
 > In [changeset:"56522" 56522]:
 > {{{
 > #!CommitTicketReference repository="" revision="56522"
 > Database: Add expiration for `dirsize_cache` to transient to improve
 performance.
 >
 > The transient `dirsize_cache` stores an array of directory sizes. This
 transient can grow very large, if the plugin directory has lots of sub
 directories in it. For example, a site with 30 plugins, the transient was
 around 2MB. For sites without a persistent object cache, transients
 without an expiration, are stored in autoloaded options. This means this
 option would load on every page request. Loading this option on every page
 request when it is not used it wasteful. Adding a expiration to this
 transient means it will not autoload. To ensure there is no degradation in
 performance, the expiration was set to a generous 10-year timeframe,
 making it highly unlikely to expire before it's refreshed.
 >
 > Props nicomollet, spacedmonkey, flixos90, wpgurudev.
 > Fixes #54221.
 > }}}

 \\


 How can I fix this issue? We have a total autoload data size of more than
 2 MB, and the biggest autoload data is from the "_transient_dirsize_cache"
 row in the "wp_options" table. How can I optimize it and increase the
 performance of the website? Since the autoload data is larger than 800 KB,
 the loading and other functionalities on the WP admin side are very slow.

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


More information about the wp-trac mailing list