Deprecate volatile sessions and allow opting out of session caching
Description
Persistent sessions have been the default for a while and have proven to be a robust and performant approach. To simplify the codebase, volatile sessions (i.e., persistent sessions disabled) should be deprecated in 26.8 and removed in 27.0. Additionally, caching of persistent sessions should be disabled by default.
Recent optimizations to the offline session storage — including async commits, improved indexes, cheaper refresh-date updates, and optimized cleanup — make persistent sessions without caching a viable default. Persistent sessions provide smaller memory usage and simpler updates , and disabling the cache significantly reduces network traffic between nodes.
Value Proposition
- Simpler codebase: Removing the volatile sessions code path reduces complexity, making the code easier to maintain and reason about.
- Lower memory footprint: Persistent sessions without caching avoid holding session data in memory across all nodes.
- Reduced impact on slow or stalling nodes when serving requests.
Goals
- Deprecate volatile sessions (persistent sessions disabled) in Keycloak 26.8 with a deprecation warning.
- Remove volatile sessions support in Keycloak 27.0.
Disable caching of persistent sessions by default.- Allow users to opt out of session caching to reduce memory usage and network traffic.
- Ensure that users already using persistent sessions experience no increase in IOPS, as the database itself provides caching.
Non-Goals
- This does not aim to remove the persistent sessions feature itself — it remains the sole supported mode.
- This does not address potential increases in DB connection usage or database CPU usage beyond documenting them as expected trade-offs.
- This does not change how offline sessions are stored or managed beyond
disablingallowing users to disable the Keycloak-side cache.
Notes
Users migrating from volatile sessions may observe increased DB connection usage and higher CPU usage on the database. For users already on persistent sessions, the database's own caching layer should prevent any additional IOPS. These trade-offs should be documented in the migration guide.
Source: keycloak/keycloak