# Storing sessions in Keycloak 26

DevFeed: [Storing sessions in Keycloak 26](<https://devfeed.tech/articles/storing-sessions-in-keycloak-26-31677.md>)

Original publisher: [Read original article](<https://www.keycloak.org/2024/12/storing-sessions-in-kc26>)

Author: Michal Hajas

Published: 2024-12-17T00:00:00Z

Content type: article

Language: en

Sources: [Keycloak Blog](<https://devfeed.tech/sources/keycloak-blog.md>)

Topics: [Keycloak](<https://devfeed.tech/topics/keycloak.md>), [Database](<https://devfeed.tech/topics/database.md>), [Replication](<https://devfeed.tech/topics/replication.md>)

Tags: [clusters](<https://devfeed.tech/tags/clusters.md>), [configuration](<https://devfeed.tech/tags/configuration.md>), [database](<https://devfeed.tech/tags/database.md>), [idm](<https://devfeed.tech/tags/idm.md>), [kerberos](<https://devfeed.tech/tags/kerberos.md>), [keycloak](<https://devfeed.tech/tags/keycloak.md>), [ldap](<https://devfeed.tech/tags/ldap.md>), [openid-connect](<https://devfeed.tech/tags/openid-connect.md>), [performance](<https://devfeed.tech/tags/performance.md>), [replication](<https://devfeed.tech/tags/replication.md>), [saml](<https://devfeed.tech/tags/saml.md>), [sessions](<https://devfeed.tech/tags/sessions.md>), [sso](<https://devfeed.tech/tags/sso.md>)

## AI overview

This Keycloak blog post explains why Keycloak 26 uses Persistent user sessions by default. It compares session storage options, including in-memory storage, external Infinispan, and database-backed persistence, and discusses resilience, performance, replication, and operational trade-offs.

## Source excerpt

Keycloak 26 now uses by default the Persistent user sessions feature. In this blog post, we uncover the background on why we introduced this feature, what are the alternatives and what is the future. Session storages in Keycloak 26 cheatsheet This section provides a TLDR guidance on what sessions storages exist and when each of them should be used with Keycloak 26. The following sections provide more details on each storage type and reasoning behind introducing or dropping each of them. Number of sites Sessions storage Characteristics When to use Keycloak CLI options to enable Single site Persistent sessions Sessions stored in the database and cached in memory Sessions available after cluster restart Lower memory usage Higher database usage Default and recommended for standard installations You want your sessions to survive restarts and upgrades Accept higher database usage No additional configuration needed Sessions stored in memory Faster reads and writes Sessions lost after cluster restart Higher memory usage (all sessions must be in memory) Can't use persistent user sessions feature Please provide your feedback here, as we want to understand why you can't use persistent user sessions --features-disabled="persistent-user-sessions" Sessions stored in external Infinispan Sessions stored only in external Infinispan Reduced database usage Using Hot Rod client for communication with external Infinispan Experimental feature Do not use in production as it is experimental Evaluate and provide your feedback here if you are interested in this feature and want to help to make it supported. --features="clusterless" --features-disabled="persistent-user-sessions" Sessions stored in memory and external Infinispan 4 copies of each session 2x in Keycloak memory and 2x in Infinispan memory Sessions available after Keycloak cluster restarts High memory usage Experimental and will be removed soon When you used this setup with previous releases and cannot switch to persistent user se