Skip to content
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

graph: Small improvments for filtering users by role #9326

Merged
merged 3 commits into from
Jun 6, 2024

Conversation

rhafer
Copy link
Contributor

@rhafer rhafer commented Jun 5, 2024

This addresses some low hanging fruits for improving the GetUsers call when filtering users by role-assignment (and expanding the assignments).

The first commit avoids a lot of extra queries to the settings service when $expand=appRoleAssignment is used together with filtering.

The second commit switch the filtering code to use the new ListRoleAssignmentsFiltered request in the settings service. Reducing the number of queries to the settings service to a single request. (Orignally it was one per existing user + one per user that matched the filter).

On my system with 1000 users (external LDAP) assigned to the User role and the metadata service using and NFS volume the query time for: $filter=(appRoleAssignments/any(m:m/appRoleId eq 'd7beeea8-8ff4-406b-8fb6-ab2dd81e6b11'))&$orderby=displayName&$expand=appRoleAssignments (the query used by web). I get this:

Cold Caches:
master: ~18s
this pr: ~14s

Hot Caches (mainly the settings service's cache and the kernel's buffercache):
master 0.8s
this pr: 0.4s

So the overall improvement isn't all that big yet (mainly because the settings service itself still needs to scan all assignments in the metadata backend in order to apply the filter). Still, there is some improvement.

Related Issue: #8938

Copy link

update-docs bot commented Jun 5, 2024

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@rhafer rhafer force-pushed the issue/8938-roleIdIndex branch from 8997cef to e6fba45 Compare June 5, 2024 14:59
rhafer added 3 commits June 5, 2024 17:21
When filtering by role assignment we now populate the
'appRoleAssignments' property of the returned users when the incoming
request contained and '$expand=appRoleAssignments'. This avoids having
to query the role assignments for all users in the result set a second
time.
The effect of this optimization depends a lot on the actual setup. In
single binary all-in-one installations it is rather small (this it saves
quite a few CPU cycles). In distributed setup it should be larger as it
reduces the number of network round trips to the settings service
significantly.
When filtering users by role-assignment we now use the new ListRoleAssignmentsFiltered
request to the settings service instead calling ListRoleAssignments for every single user.
This reduces the number of network roundtrips to the settings service to one (was one per
user before).

Related Issue: owncloud#8938
@rhafer rhafer force-pushed the issue/8938-roleIdIndex branch from e6fba45 to 3d635ac Compare June 5, 2024 15:21
Copy link

sonarqubecloud bot commented Jun 5, 2024

@rhafer rhafer requested review from micbar, butonic and kobergj June 6, 2024 07:02
@rhafer rhafer merged commit 254c9d7 into owncloud:master Jun 6, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants