Switch default offline sessions to lazy loaded

This commit is contained in:
Martin Kanis 2022-01-17 14:31:34 +01:00 committed by Hynek Mlnařík
parent ef2e806ac5
commit 1565700fc8
3 changed files with 18 additions and 7 deletions

View file

@ -13,6 +13,9 @@ include::topics/templates/document-attributes-community.adoc[]
:release_header_latest_link: {releasenotes_link_latest}
include::topics/templates/release-header.adoc[]
== {project_name_full} 17.0.0
include::topics/17_0_0.adoc[leveloffset=2]
== {project_name_full} 16.1.0
include::topics/16_1_0.adoc[leveloffset=2]

View file

@ -4,3 +4,8 @@
{project_name} now supports a glob-like syntax for the user search when listing users in the Admin Console,
which allows for three different types of searches: prefix (`foo*` which became the default search), infix (`\*foo*`), and exact `"foo"`)
== Offline sessions lazy loaded
The offline sessions are now lazily fetched from the database by default instead of preloading during the server startup.
To change the default behavior, see link:{adminguide_link}#offline-sessions-preloading[{adminguide_name}].

View file

@ -1,13 +1,16 @@
[[offline-sessions-preloading]]
=== Offline sessions preloading
In addition to {jdgserver_name} caches, offline sessions are stored in a database which means they will be available even after server restart.
By default, the offline sessions are preloaded from the database into the {jdgserver_name} caches during the server startup.
However this approach has a drawback if there are many offline sessions to be preloaded. It can significantly slow down the server startup time.
By default, the offline sessions are not preloaded from the database into the {jdgserver_name} caches during the server startup, because this
approach has a drawback if there are many offline sessions to be preloaded. It can significantly slow down the server startup time.
Therefore, the offline sessions are lazily fetched from the database by default.
To overcome this problem, {project_name} can be configured to fetch offline sessions into the {jdgserver_name} caches on demand.
It can be achieved by setting `preloadOfflineSessionsFromDatabase` property in `userSessions` SPI to `false`.
However, {project_name} can be configured to preload the offline sessions from the database into the {jdgserver_name} caches during the server startup.
It can be achieved by setting `preloadOfflineSessionsFromDatabase` property in the `userSessions` SPI to `true`.
The following example shows how to configure lazy offline sessions loading.
The following example shows how to configure offline sessions preloading.
[source,xml]
----
@ -17,7 +20,7 @@ The following example shows how to configure lazy offline sessions loading.
<default-provider>infinispan</default-provider>
<provider name="infinispan" enabled="true">
<properties>
<property name="preloadOfflineSessionsFromDatabase" value="false"/>
<property name="preloadOfflineSessionsFromDatabase" value="true"/>
</properties>
</provider>
</spi>
@ -30,5 +33,5 @@ Equivalent configuration using CLI commands:
[source,bash]
----
/subsystem=keycloak-server/spi=userSessions:add(default-provider=infinispan)
/subsystem=keycloak-server/spi=userSessions/provider=infinispan:add(properties={preloadOfflineSessionsFromDatabase => "false"},enabled=true)
/subsystem=keycloak-server/spi=userSessions/provider=infinispan:add(properties={preloadOfflineSessionsFromDatabase => "true"},enabled=true)
----