We are having a Keycloak 4.8.1.Final deployed on a k8 cluster with two nodes with default settings. Backend database is PostgreSQL.
We are increasing the number of realms in Keycloak to figure out if Keycloak can support a larger number of realms; these creations are done sequentially.
However, when the quantity of realms reach around 470, it makes keycloak basically unusable with admin GUI not loading at all and requests taking too long to execute.
Below is a summary of the time taken. We have not added any users into the realms.
+--------------+----------+------------+------------+------------+
| Operation | 0 realms | 100 realms | 250 realms | 350 realms |
+--------------+----------+------------+------------+------------+
| Create realm | 1104 | 3739 | 8659 | 11535 |
| Get realm | 128 | 961 | 3067 | 3853 |
| Get token | 636 | 1159 | 2714 | 3197 |
| Get roles | 127 | 1037 | 3034 | 3649 |
+--------------+----------+------------+------------+------------+
Are there any known limitations or an optimal number of realms for a Keycloak deployment?
Already raised in user group as well.
pg_stat_statements
extension for your Postgres instance, and sharing info on the performance of DB queries, e.g. usingSELECT * FROM pg_stat_statements ORDER BY max_exec_time DESC
.keycloak
process while waiting for requests to finish? b) what's the CPU usage of thepostgres
process? c) what machine type (CPU, RAM, disk type) is thekeycloak
andpostgres
processes running on? Which of these are the bottleneck?