[keycloak-user] Admin client API - usersResource.list(offset, limit) - slowness

Dmitry Telegin dt at acutus.pro
Fri Feb 1 14:35:56 EST 2019

Hello Shweta,

What version of Keycloak are you using? How many users/clients/roles are there?

The query is invoked from o.k.models.jpa.ClientScopeAdapter::getScopeMappings() method [1]. In my setup, it is only called about a dozen of times during server startup. You can set a tracepoint on that method to make sure it is called that frequently, and to determine the code path that leads to this.

[1] https://github.com/keycloak/keycloak/blob/master/model/jpa/src/main/java/org/keycloak/models/jpa/ClientScopeAdapter.java#L232

Good luck,
Dmitry Telegin
CTO, Acutus s.r.o.
Keycloak Consulting and Training

Pod lipami street 339/52, 130 00 Prague 3, Czech Republic
+42 (022) 888-30-71
E-mail: info at acutus.pro

On Wed, 2019-01-30 at 23:14 +0000, Shetty, Shweta wrote:
> We are seeing extreme slowness in using this API, we are still not sure what could be the culprit. We enabled more logging on the postgres side of thing, thinking it could be related to keycloak – postgres slowness. Once we enabled more logging, we do see that keycloak is issuing a query like this one at a rate of about one per millisecond
> ```select clientscop0_.ROLE_ID as col_0_0_ from CLIENT_SCOPE_ROLE_MAPPING clientscop0_ where clientscop0_.SCOPE_ID=$1```
> This fills up the logs so that it is hard to see anything else.
> This could be the cause of the problem; which could be slowing postgres down. We wanted to know if its some configuration issue which we can optimize to overcome this issue or if it’s a known issue. Please advice.
> Shweta
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user

More information about the keycloak-user mailing list