cloudfoundry / cloudfoundry/uaa
Overall performance issue for Get All User api - GET /Users
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.6k
- Forks
- 844
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 27
Description
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?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ScimUserEndpoint.java and trace findUsers() through syncGroup() and getGroupsWithMember(), then inspect getDefaultUserGroups(). Analyze the shown group_membership query and its existing index with the MySQL query plan. Done means avoiding redundant user and default-group lookups where possible and validating whether an additional composite index improves the request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- backend, database, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100