I am facing performance issue while using keycloak. The user count is relatively small – touching 2 million users.
We are using GCP managed postgres DB underneath
Specs:
Spec | Value |
---|---|
Memory | 8GB |
vCPU | 6 |
SSD | 31GB |
Query:
SELECT
federatedu0_.GROUP_ID AS group_id1_26_,
federatedu0_.USER_ID AS user_id2_26_,
federatedu0_.REALM_ID AS realm_id3_26_,
federatedu0_.STORAGE_PROVIDER_ID AS storage_4_26_
FROM
public.FED_USER_GROUP_MEMBERSHIP federatedu0_
WHERE
federatedu0_.USER_ID=$1
This query is called 2.36 million times per hour and average time taken is 0.01ms. I believe this one is causing a good amount of load on the DB. And more than that why is being called too many times.
Other than that, the maximum load is shown by UTILITY COMMAND
and I am not able to debug it right now. This one is also taking 1ms of time and is called 270k per hour. Maybe I will raise a different question for the same.
I have tried increasing the number of prepared connections and maximum connections, now its set to 400, both the configs. We have also increased the DB specs.