[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
Wed Oct 6 14:38:25 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
--------------------------+-------------------------------------

Comment (by iandunn):

 Another idea that might be a better solution for the `dirsize_cache`
 expansion: instead of storing the raw size of every folder, we could just
 store the total size (for each site in Multisite). AFAIK that's the only
 thing we need, and storing the individual sizes is for performance.

 Instead of calculating the size synchronously (but with the data partially
 cached), we could do a full calculation '''asynchronously''', and cache
 the result. That way the user always sees cached data, which is faster and
 avoids storing megabytes of data in an option.

 It would get stale when files are uploaded/removed, but we could hook into
 those processes and manually add/subtract the file size from the cached
 total size. That should keep the size accurate enough until the cron job
 runs again.


 That would need some more research to make sure it'd meet all the current
 requirements that `dirsize_cache` serves, including #19879 and #46645.

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


More information about the wp-trac mailing list