[wp-trac] [WordPress Trac] #42280: Multisite: get_blogs_of_user has no useful caching on large installs

WordPress Trac noreply at wordpress.org
Thu Oct 19 17:38:31 UTC 2017


#42280: Multisite: get_blogs_of_user has no useful caching on large installs
--------------------------------+-------------------------------------
 Reporter:  westi               |       Owner:
     Type:  defect (bug)        |      Status:  new
 Priority:  high                |   Milestone:  Awaiting Review
Component:  Networks and Sites  |     Version:  4.7
 Severity:  major               |  Resolution:
 Keywords:  2nd-opinion         |     Focuses:  multisite, performance
--------------------------------+-------------------------------------

Comment (by westi):

 Replying to [comment:1 flixos90]:
 > @westi We are currently looking into improving caching in
 `WP_Site_Query` so that it is less aggressively invalidated for certain
 queries. By making changes to `WP_Site_Query`, we would ensure that all
 functions using `get_sites()` would get these benefits. #42252 is the
 ticket where this is being worked on, if you are interested in that.
 >

 Great, I'm trying to document specific cases I find where switching to
 `get_sites` seems to have caused a significant regression in cache
 performance so as to make sure each case can be reviewed for a better
 solution.

 > I'm not opposed to adding special caches to certain functions that
 require more unique lookups though. For the case of `get_blogs_of_user()`,
 it may likely be the best option to make it work closer to what it was
 like before:
 >
 > * Upon having all the site IDs, call `_prime_site_caches()` for it in
 order to not require countless DB queries.
 > * Then, for each site ID, call `get_site()` and build the array with it.

 I think that is probably a great solution, for now I have just reverted us
 back to using `get_blog_details` but happy to test out a patch for a
 better solution and see how it performs in our use cases.

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


More information about the wp-trac mailing list