There a site with about 140 total groups that act as parents (including sub parents, about 5 levels deep) but all like 6k~ other groups are under these parents, so for a user in all top level parent groups, og_subgroups_children_load_multiple ends up looking for children for akk 6k groups.

So, instead of looking individually if a sub group has children, if we fetch all 140 group ids and only process groups in that set, it'll signicactly cut down on the processing/database queries/etc.

But for sites that have simpler hierarchy, there could be 6k+ parents (that each member is only a member of a few and that each have only a few children) and this wouldn't be a good approach, so added a switch variable to turn it on/off.

Comments

hefox’s picture

StatusFileSize
new7.14 KB

wrong patch...

hefox’s picture

StatusFileSize
new5.42 KB

wrong sandbox..

hefox’s picture

StatusFileSize
new5.4 KB

I made some mistakes when taking it from locally patched to git version :(

dafeder’s picture

hefox, I'm very excited to see this patch because I am having this problem as well. I don't have a complex hierarchy - just one parent-child relationship, but a parent can have several thousand children. For the members of those parent groups the site slows down to a crawl as it adds thousands of ORs to every query.

I'll test out your patch and give you feedback asap.

dafeder’s picture

ALthough - as I look more carefully at your logic I'm not sure it applies to my case.

hefox’s picture

Guess didn't mention it, but try setting og_subgroups_deep_tree_performance to true when testing it (that'll enable the patch improvments)

Ahmad_Husseini’s picture

Hi,

Thanks for this, I confirm that this works perfectly, as per above, I had to run this
sudo drush vset --yes og_subgroups_deep_tree_performance TRUE

mpotter’s picture

Status: Needs review » Reviewed & tested by the community

Marking this RTBC because Open Atrium has been using this for a while now. Will commit this soon unless there are objections.

Ahmad_Husseini’s picture

Yes please commit.

mpotter’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 48fcebd.

  • mpotter committed 48fcebd on 7.x-2.x authored by hefox
    Issue #2447683 by hefox: Better performance for sites that have few...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.