-
Notifications
You must be signed in to change notification settings - Fork 88
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use already cached parents when fetching ACL #1694
Conversation
Alright, I understand why the cap is messing up: we're putting new rules in a loop and in that loop some earlier entries get discarded. However, in the context of the function, we already assumed that those removed entries were cached. Would be nice to be able to disable the cap while doing a "transaction" there. |
4e81b73
to
2bb5c4b
Compare
I managed to fix the problem by reading the already cached rules from the cache, then filling in the missing ones, and then returning. This makes the code independent from the cap logic while the function is running. |
@icewind1991 mind double checking the logic ? I'm not sure if there was a reason why we always wanted to re-query the parents for each request. |
@come-nc I've modified the code according to your review and retested locally. Please have a second look. |
Unit tests are not happy and could you rebase? |
back to draft mode thanks to @come-nc for pointing out my thinking mistake I had disabled siblings pre-fetching which is likely why everything got faster. 12 seconds is still better than 20s, so it means my original optimization did help, but it's still too much. I'll try and understand siblings prefetching better and see if it fits this use case. Needs further research... |
in my test case, the 1200 entries are in "sub":
so the direct parent is always "__groupfolders/1/sub" and is called repeatedly, like 1200 times. it seems we'd need another kind of cache that tells that we already fetched all rules for the children of this entry unless we can assume that if the key for "__groupfolders/1/sub" then the keys for the children are already there, which would bring the code back to what it was before the last commit. Not sure if we can assume that though. |
So it seems that in my first attempt, I mistakenly disabled the sibling fetching and performance was already much better, so I wonder if we really need that. Or if there are scenarios (not PROPFIND) where we'd need to fetch the siblings ? @icewind1991 do you remember the scenarios ? |
I think it was propfind related with how the properties are/were fetched file by file. I'm not sure if that still applies though, so it things seem better without it than thats fine by me |
I had a look at It will only return rules if they exist instead of returning all the paths, so we can't cache the information "no rules for path X" as a result. This seems to tell me that the purpose of that approach was a different one. For now in my local env I've added a Now, another possible concern: if we do change If I don't find a better solution I'll leave it as is, plus the |
After more testing I've observed that It might be possible to optimize this further by reworking the overall logic, but for the sake of fixing the performance issue (and considering the time already spent on this issue), I'd like to keep this fix minimal. Therefore, I have now removed the sibling fetching. |
When fetching ACL rules, don't refetch the rules from already cached parents. This fixes performance issues with large folders. Removed sibling prefetching becasue this information is already retrieved by getRules() earlier as it's being called with all the parent paths. This significantly improves performance. Signed-off-by: Vincent Petry <[email protected]>
e3d2ec9
to
7f72ce9
Compare
fixed psalm issues, squashed, rebased |
/backport to stable21 |
/backport to stable20 |
note to self: make sure to properly test in case the conditions for the "sibling fetching" were different there |
/backport to stable22 |
When fetching ACL rules, don't refetch the rules from already cached
parents. This fixes performance issues with large folders.
Fixes #1693
Improves performance with 1100 entries from 20 seconds to 4 seconds.