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

Overall performance issue for Get All User api - GET /Users #3261

Open
rohit-armorikar opened this issue Jan 30, 2025 · 1 comment
Open

Overall performance issue for Get All User api - GET /Users #3261

rohit-armorikar opened this issue Jan 30, 2025 · 1 comment

Comments

@rohit-armorikar
Copy link

We are using UAA version: 77.10.0
We are on MYSQL DB: 8.0.mysql_aurora.3.05.2

In ScimUserEndpoint.java, we fetch complete user data from RDS, for given identity_zone_id.

Case 1:
In findUsers() -> syncGroup() -> getGroupsWithMember() → we again fetch the user data from RDS.

Problem: This looks like repeated query on Database.

Can we have a check, before checking in DB for users, that if this user was already fetched from last query, we will avoid querying on User table again.
And only in case the user is coming from another transitive group, we can have this check.

Case 2:
Similarly, in same flow, we fetch default user groups for user.
getDefaultUserGroups(),

Problem: Again this query is being performed repeatedly on Database. For 100 users, 100 times for 1 request.
Whereas the default groups remains same for an identity zone.

Case 3:
We already have index as "CREATE UNIQUE INDEX group_membership_unique_key ON group_membership (member_id,group_id);"
However for below example of query:
SELECT g.id, g.displayName, g.description, g.created, g.lastModified, g.version, g.identity_zone_id
FROM groups g, group_membership gm
WHERE gm.group_id = g.id
AND gm.identity_zone_id = g.identity_zone_id
AND gm.identity_zone_id = 'my_identity_zone'
AND gm.member_id IN ('my_user_id');

The above query is giving us performance issues, so it may require another composite index as below:
CREATE INDEX idx_group_membership_zone_member_group
ON group_membership (identity_zone_id, member_id, group_id);

Can we analyze the performance of this query and add any composite index if required?

@strehle
Copy link
Member

strehle commented Feb 1, 2025

@rohit-armorikar Thanks for reporting... we (SAP) use postgresql and we have additional indexes created, however we should check if in mysql something missing or a general problem, means also in postgresql.

We have improved /Users with some PRs @adrianhoelzl-sap can you help here, please ?

FYI @torsten-sap can you ask someone from your team in addition if there is something we know about

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants