On this page
Short answer
In a Keycloak cluster, most outages trace back to four shared things: the database every node depends on, the Infinispan caches the nodes replicate, the discovery stack that lets nodes find each other, and the load balancer in front. Each fails differently, and a restart rarely tells you which one broke.
In a Keycloak cluster, most outages trace back to four shared things: the database every node depends on, the Infinispan caches the nodes replicate, the discovery stack that lets nodes find each other, and the load balancer in front. Each fails differently, and a restart rarely tells you which one broke.
A highly available Keycloak deployment, whether on Kubernetes or VMs, is more than two nodes behind a load balancer. This post draws on Keycloak's high availability and caching guides and describes what they document about the cluster, not a setup procedure. If you run a cluster and want an engineer on call for it, see our Keycloak support page.
What does Keycloak share across nodes, and what does it keep local?
Keycloak's caching guide splits caches in two. Distributed caches (sessions, clientSessions, offlineSessions, offlineClientSessions, authenticationSessions, loginFailures, actionTokens) are shared between nodes. Local caches (realms, users, authorization, keys, crl) sit on each node and rely on a replicated work cache for invalidation messages.
| Layer | Where it lives | What a failure looks like |
|---|---|---|
| Distributed caches | Memory across nodes | Each session entry has an owner node, so a lost node matters |
| Local caches | Memory on each node | Cold after restart, so database load rises |
| User sessions | Database by default | Database problems become login problems |
| Discovery | jdbc-ping by default | Nodes fail to form one cluster |
Are user sessions lost when a Keycloak node restarts?
By default, no. The caching guide says persistent user sessions are stored in the database, and only the deprecated volatile mode loses "all user sessions" when all nodes restart. Volatile sessions are deprecated since 26.8; removing --features-disabled=persistent-user-sessions returns you to the default.
Authentication sessions, the short-lived state in the middle of a login, are a different matter. The HA overview lists them as in-memory in a single cluster and in the database in multi-cluster v2. So a rolling restart can interrupt logins in progress even when established sessions survive.
What breaks when cluster discovery is wrong?
Nodes that cannot find each other form separate clusters, and the shared caches stop being shared. The default stack is jdbc-ping, which uses the database as a node registry. The kubernetes stack, now deprecated, needs jgroups.dns.query set to a headless service name.
Network details matter too. The guide names port 7800 for data transfer and 57800 for failure detection, and TCP-based stacks use TLS between nodes by default. Without a custom keystore, Keycloak generates a self-signed certificate, valid for 60 days and rotated every 30 days by default. Several clusters sharing one database need distinct --cache-embedded-cluster-name values; the default is ISPN.
Why is the database the real single point of failure?
Both single-cluster and multi-cluster v2 deployments, per the HA overview, require a synchronously replicated database. Sessions, and in the default configuration the node registry, depend on it, so Keycloak nodes can look healthy while logins fail. The guides do not say it in those words, but it follows from where the state lives.
The single-cluster guide asks for round-trip latency under 10 ms between instances, and a database that tolerates zone failures. The database connection guide warns that opening many connections at once causes a stampede that "slows down the system and blocks threads," and advises equal initial, minimum and maximum pool sizes. If every node reconnects at once after an outage, plan pool sizes with that in mind.
Do you still need sticky sessions on the load balancer?
No, according to the reverse proxy guide. Since 26.6, sticky sessions no longer give a significant benefit, and Keycloak recommends an even distribution of load across nodes instead. The sticky-session encoder options are deprecated as of 26.8 and will be removed.
The load balancer still has jobs. The production guide says to use /health/ready for load balancer checks, and --server-async-bootstrap=false to accept connections only after bootstrap completes. Keycloak also notes that throttled pods perform poorly, and advises 150% extra CPU headroom for spikes, node start and failover. The production guide also lets you cap queued requests with http-max-queued-requests, so that requests over the limit receive an immediate 503, a form of load shedding that protects a node under overload. Our what to alert on post covers which signals to watch.
What do a failed upgrade or a full outage look like in a cluster?
The single-cluster guide says downtime can still occur with simultaneous node failures, during upgrade rollouts, or when the infrastructure underneath fails, and the design accepts periodic outages. For stricter goals it points to multi-cluster v2, which needs an external load balancer and roughly double the database CPU and write IOPS in its estimate.
Deployers, the guide says, are responsible for designing, validating and operating the end-to-end architecture. Read the HA overview before choosing, and pair it with our upgrade and rollback failure modes post.
When should you call for help?
Call when logins are failing and you cannot tell whether the cause is the database, the cache cluster or the load balancer, or when a cluster has never been tested through a node loss. AceMQ senior engineers support Keycloak operations on community or Red Hat build installs, 24/7. We sell no Red Hat subscriptions and do not advise on their licensing. See Keycloak consulting for architecture review.
Sources
Frequently Asked Questions
Do Keycloak user sessions survive a restart of all nodes?
With the default persistent user sessions, yes: they are stored in the database. Keycloak's caching guide says only the deprecated volatile mode loses all user sessions when every node restarts. In-progress logins held in authentication sessions can still be interrupted.
What is the default Keycloak cluster discovery method?
The caching guide names jdbc-ping as the default stack. It uses the database as a node registry over TCP. The kubernetes stack, based on DNS_PING, is deprecated and needs jgroups.dns.query set to the headless service name.
Does Keycloak need sticky sessions behind a load balancer?
Not since 26.6, per the reverse proxy guide: sticky sessions no longer offer a significant benefit, and an even distribution of load is recommended. The related sticky-session encoder options are deprecated as of 26.8.
Talk to an engineer
Need a hand with Keycloak?
Senior engineers who run it in production. Get a quote or a free consultation, no sales pitch.

