[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 5 19:02:31 UTC 2021
#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: Awaiting Review
Component: Database | Version: 2.8
Severity: major | Resolution:
Keywords: | Focuses: multisite, performance
--------------------------+-------------------------------------
Changes (by iandunn):
* focuses: => multisite, performance
* version: 5.8.1 => 2.8
Comment:
Thanks for reporting this!
I'm assuming the following about your site:
* it's ''not'' a Multisite instance
* it doesn't use object caching
* the site with the 20mb `dirsize_cache` has 207k folders in its upload
directory
* sites with fewer upload subfolders have smaller `dirsize_cache` values,
which are proportional to the # of folders
Is all of that correct?
At first glance, it does look like `dirsize_cache` can grow indefinitely
based on the # of folders. The transient isn't set with an expiration,
which seems intentional/correct, given the purpose. It also seems like it
shouldn't be autoloaded, since it's only used on the Dashboard, file
upload/deletion, and Site Health.
It looks like `set_transient()` sets `$autoload` to `yes` for this
situation, and it doesn't allow the caller to override that. This doesn't
seem directly related to r49744; it looks like it goes all the way back to
when the concept of expiration was added to transients in r10603.
I don't see a ticket for that commit, though, or any documentation in the
code. It's not obvious to me why `autoload` would be tied to expiration;
it seems like it should be tied whether the average performance is better
when it's loaded w/ all the options, or only when needed. Maybe expiration
was thought to be a good proxy for that?
`dirsize_cache` was added for Multisite instances when Multisite was
merged to Core in r12603. It was repurposed for Site Health (both single-
and Multisite instances) in r45104.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54221#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list