Limitations of Keycloak

Hello,

I’m currently running the keycloak version 16.1.1 on an eks (kubernetes v1.21) cluster. It is deployed in HA using a minimum of 3 replicas and a PostgreSQL database v13.3 deployed as managed service on AWS.
For the deployment i have used the following helm chart (helm-charts/charts/keycloak at master · codecentric/helm-charts · GitHub) where I added the following resources:

resources:
  limits:
    cpu: 4000m
    memory: 6000Mi
  requests:
    cpu: 3000m
    memory: 4000Mi

There are over 100 realms and I plan on adding more. I saw a decrease in performance after adding the 120th realm (which made me give more CPU resources, increased limit from 1500m to 4000m).

My question is:
Is there a limitation in the number of realms that can be added?
Can I add as many realms as I need (over 1000) without seeing performance impacts by only increasing the resources allocated to the keycloak (CPU and memory)?

Thank you

I hope this issue will help you. It does sound like you can anticipate difficulties with that many realms.

https://issues.redhat.com/browse/KEYCLOAK-4593

I do know of an organization that chose to move to a “shared realm” model to avoid this problem. I think they had hundreds of realms, now they have a handful.

Thank you, I read this jira issue, but it looks like they are talking about older versions of keycloak. 2 years ago someone mentioned that a fix was added to the version 11, but i still wonder if there is a limitation in the number of realms

Hello Norocas, thanks for sharing your experience. We are running Keycloak using the Bitnami helm chart in EKS (AWS) with Postgres RDS. But not sure how to setup the high availability mode for pods, also the cache setup. Could you share how you got Keycloak running on EKS with being successful with that many realms. Appreciate your response!