[keycloak-dev] large number of realms causing slow api calls
Gideon Caranzo
gideonray at gmail.com
Thu Oct 4 11:26:38 EDT 2018
Hi,
I'm encountering slow api calls after reaching 1700 realms. I profiled it
and found that role checking is causing the issue particularly
*KeycloakModelUtils.searchFor(RoleModel
role, RoleModel composite, Set<String> visited)*.
I'm using a user with "admin" role to call get realm API. And since i have
1700 realms, "admin" role now have about 30K composite roles under it. The
line below from KeycloakModelUtils.searchFor() will load all 30K composite
roles causing the slow down.
*Set<RoleModel> compositeRoles = composite.getComposites();*
Is there a way to avoid this issue? Or is it possible to fix the code such
that it will do a database query instead of searching in memory to check if
the role exist?
Best regards,
Gideon
More information about the keycloak-dev
mailing list