We have Keycloak deployed in Kubernetes (this helm chart: https://github.com/codecentric/helm-charts/tree/master/charts/keycloak ) and we are performing load tests at the moment, but we are having problems.
Our setup is the following:
4 pods with 500m (half a core) and 1gb memory each;
1 external PostgresSQL instance
When we run the load tests, Keycloak becomes super slow (it takes 10 or 20 seconds to get a response to the query), which can make sense if the problem is the database.
However, the reason why I’m posting this topic is that Keycloak is also super slow AFTER the load tests are over. It takes ~10sec to get the user list for a given realm, for example. And we found out that if we clear the realm cache, keycloak becomes fast again.
So, my question is: can someone explain why does the realm cache have such a big performance impact in Keycloak? And can someone give advice on how to solve this?