Category: Software

If you have offline sessions enabled in Keycloak and there are lots of them stored in the database (e.g. more than 300k) you will notice that the time it takes to start up can be up to more than 20 minutes. In this article I will share some tips we implemented to make it go faster. In our case, we managed to start up with 750k offline sessions in 2 only minutes 58 seconds, instead of ~15 minutes! I will also explain how to programmatically change the value of the property sessionsPerSegment, both in the XML configuration and using the JBoss CLI, which is crucial to improve the startup times.

This property seems to determine the amount of offline sessions that will be loaded up in every “batch”; at least that’s my understanding from debug level logs during startup.

Related Articles