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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 2447683-og_subgroups-deep-tree-3.patch | 5.4 KB | hefox |
| #2 | 2447683-og_subgroups-deep-tree-2.patch | 5.42 KB | hefox |
Comments
Comment #1
hefox commentedwrong patch...
Comment #2
hefox commentedwrong sandbox..
Comment #3
hefox commentedI made some mistakes when taking it from locally patched to git version :(
Comment #4
dafederhefox, 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.
Comment #5
dafederALthough - as I look more carefully at your logic I'm not sure it applies to my case.
Comment #6
hefox commentedGuess didn't mention it, but try setting og_subgroups_deep_tree_performance to true when testing it (that'll enable the patch improvments)
Comment #7
Ahmad_Husseini commentedHi,
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
Comment #8
mpotter commentedMarking this RTBC because Open Atrium has been using this for a while now. Will commit this soon unless there are objections.
Comment #9
Ahmad_Husseini commentedYes please commit.
Comment #10
mpotter commentedCommitted to 48fcebd.