[keycloak-user] Poor response time for User REST API

Cedric Vidaillac cedric.vidaillac at gmail.com
Thu Mar 1 05:53:05 EST 2018


After minor investigations,

I found out that the query is eating all up, I've added some logs in
UsersResources.getUsers (keycloak-services), restarted server.

I added a rudimentary stopwatch at method start, and here is the result:

   - Require query: 1ms
   - Executing query: 6837ms
   - Mapping to List<UserRepresentation>: 7350ms

Total response time (postman) 7436ms, yesterday it was around 20s, I don't
know why it went down, but it's still quite poor.

So the query seems to be the problem here. The implementation used is
org.keycloak.models.cache.infinispan.UserCacheSession.

I forgot to say that I'm using 3.4.3.Final.

I'm not going to try to compile master, I will wait for next version.

Thanks.


On Thu, Mar 1, 2018 at 8:05 AM, Marek Posolda <mposolda at redhat.com> wrote:

> No, that's why I mentioned that you would need to build latest master.
> That will allow you to check early. Other option is to wait for first alpha
> 4.0 release, but not sure when it will be released.
>
> Marek
>
>
> On 28/02/18 23:13, Chris Savory wrote:
>
>> Has that performance fix been released yet? If so, do you know which
>> version it is in?
>>
>> --
>> Christopher Savory
>>
>> On 2/28/18, 2:01 PM, "keycloak-user-bounces at lists.jboss.org on behalf of
>> Marek Posolda" <keycloak-user-bounces at lists.jboss.org on behalf of
>> mposolda at redhat.com> wrote:
>>
>>      I think there is some fix in latest Keycloak master related to that.
>>      Could you try to build latest master and check if you see better
>>      perofmrnace?
>>           Marek
>>           On 28/02/18 18:22, Cedric Vidaillac wrote:
>>      > Hi all,
>>      >
>>      >
>>      >
>>      > I have ~4k users imported in my (postgres) database, when I go for
>>      >
>>      >
>>      >
>>      > GET /{realm}/users/
>>      >
>>      >
>>      >
>>      > For max=100 (default) it takes about 20-22s to respond (60kb
>> document).
>>      >
>>      > For max=20, I still get 4s response time, which is kinda... not
>> ideal.
>>      >
>>      >
>>      >
>>      > I’m not sure if those response time are normal, and if not why is
>> this so
>>      > slow ?
>>      >
>>      >
>>      >
>>      > I’m guessing this overhead is caused by the JSON response, I tried
>> on the
>>      > database (>20ms). -> is there a way to reduce the JSON data
>> response
>>      > produced by Keycloak ? I only need usernames.
>>      >
>>      >
>>      >
>>      > I didnt find anything on the docs, I tried ?fields=username in
>> query param,
>>      > sadly it doesn’t work.
>>      >
>>      >
>>      >
>>      >
>>      >
>>      >   In case you’re wondering why I do that, I want to use an
>> auto-complete on
>>      > my app, with usernames.)
>>      >
>>      >
>>      > Thanks for reading.
>>      >
>>      >
>>      >
>>      > Cédric.
>>      > _______________________________________________
>>      > keycloak-user mailing list
>>      > keycloak-user at lists.jboss.org
>>      > https://lists.jboss.org/mailman/listinfo/keycloak-user
>>                _______________________________________________
>>      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