Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

pmentz
Copy link

@pmentz pmentz commented Nov 18, 2021

Hi everyone,

we use Keycloak in a multi-tenant environment (~700 tenants) and the master realm Admin Console is essentially unusable for us due to performance problems with the whoami endpoint.

This PR introduces a per-realm-usage of the whoami endpoint from the Web Admin Console. The changes should be backward compatible and the usage of the additional realm parameter for the whoami endpoint is limited to requests of the master realm.

@binaryfire

This comment was marked as off-topic.

Comment on lines +263 to +268
session.realms().getRealmsStream()
.filter(r -> realmName == null || realmName.equals(r.getName()))
.forEach(realm -> {
ClientModel realmAdminApp = realm.getMasterAdminClient();
getRealmAdminAccess(realm, realmAdminApp, user, realmAdminAccess);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why list/filter and not just grab the realm by name? Something like this:

Suggested change
session.realms().getRealmsStream()
.filter(r -> realmName == null || realmName.equals(r.getName()))
.forEach(realm -> {
ClientModel realmAdminApp = realm.getMasterAdminClient();
getRealmAdminAccess(realm, realmAdminApp, user, realmAdminAccess);
});
RealmModel realm = session.realms().getRealmByName(realmName);
getRealmAdminAccess(realm, realmAdminApp, user, realmAdminAccess);

@stianst
Copy link
Contributor

stianst commented Jun 29, 2023

@pedroigor @mposolda @ahus1 something like this would probably be a nice small increment towards scaling better for many realms.

@jonkoops @EricWittmann would it be hard to update this for the new admin console so it fetches whoAmI when the selected realm changes?

@jonkoops
Copy link
Contributor

jonkoops commented Jul 3, 2023

would it be hard to update this for the new admin console so it fetches whoAmI when the selected realm changes?

Should not be to hard, we can add the realm as a dependency here and it should re-fetch it automatically.

Copy link
Contributor

@pedroigor pedroigor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stianst Looks good to me. It is a similar approach to what I did a long time ago. See #7712.

Loading all realms does not make sense when calling that endpoint.

For me, we can just have it once we include the changes to the new admin UI.

@stianst
Copy link
Contributor

stianst commented Jul 17, 2023

Follow-up for this one: #21554

@stianst stianst closed this Jul 17, 2023
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.

5 participants