Locke is a drop-in Keycloak distribution that runs Keycloak's caching on Redis instead of an embedded JGroups cluster. Same admin console, same database, one switch (KC_CACHE=redis).
What is Locke
Locke is the upstream Keycloak codebase plus one thing: a Redis cache backend behind a single switch. Same SPIs, same admin console, same database schema. Flip it back and you have ordinary Keycloak.
Flip KC_CACHE=infinispan|redis at boot. No code changes, no migration.
Fully open source: stock Keycloak plus a Redis cache backend, nothing locked away.
Works with any managed Redis. Colocated or external performs the same.
No cluster discovery, split-brain handling, or state transfer. Redis coordinates.
The benchmark
A 3-pod production cluster, head to head. Throughput is a tie. The difference shows up the moment a node dies.
| Load (logins/sec) | Stock / Infinispan | Locke / Redis | Parity |
|---|---|---|---|
| 80 | 274 req/s | 274 req/s | 100% |
| 160 | 548 req/s | 548 req/s | 100% |
| 250 | 856 req/s | 856 req/s | 100% |
Bars use a compressed scale to keep Locke visible; the gap is ~15-34x. When an Infinispan node dies, the cluster stalls on a JGroups rebalance and state transfer. Locke keeps serving from Redis.
3-pod cluster, Keycloak 26.6.1, start --optimized, keycloak-benchmark Gatling AuthorizationCode flow. Full methodology in the report.
Why it matters
A lost node is a sub-second blip, not a 31-second JGroups rebalance stall that hangs authentication mid-incident.
Across an Infinispan-version boundary the recommended Keycloak path is a brief planned restart; Locke can do that same upgrade as a rolling update because there is no JGroups version handshake. Keycloak doesn't guarantee no-downtime minor upgrades in general, so this is one fewer constraint, not a blanket promise.
Point Keycloak at the managed Redis you already run and monitor. No JGroups discovery, no state transfer, one less distributed system to operate.
Quick start
Run the Locke image in production mode and point it at your Redis.
The honest part
An honest trade. Moving local caches to Redis adds a few milliseconds of read latency at moderate load (both stay under 170ms p99 to 250 logins/sec). And Redis does not raise Keycloak's realm-count ceiling. That limit is database-bound, not cache-bound. We benchmark these things and say so.
Open source, Apache 2.0, benchmarked in production mode.