[keycloak-user] slow role search

Gideon Caranzo gideonray at gmail.com
Mon Oct 1 16:14:06 EDT 2018


Do you know a workaround to improve this? Thanks.

On Thu, Sep 27, 2018 at 12:02 PM Gideon Caranzo <gideonray at gmail.com> wrote:

> Hi,
>
> I'm running Keycloak with 1700 realms and API calls like getting a realm
> now takes a lot of time. 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?
>
> Thank you,
> Gideon
>


More information about the keycloak-user mailing list