Infinispan Cache Config Recommendation

Hi,

we have found that our keycloak in cluster mode runs on errors at some point.

ISPN000136: Error executing command PutKeyValueCommand on Cache 'offlineSessions', writing keys [5bd3a9cd-8993-427e-bdf3-dcdf6ed8c27e]: org.infinispan.util.concurrent.TimeoutException: ISPN000427: Timeout after 15 seconds waiting for acks. Id=850319
Uncaught server error: org.infinispan.util.concurrent.TimeoutException: ISPN000476: Timed out waiting for responses for request 944963

… CODE_TOT_TOKEN_ERROR
and so go on.

We suspect that the configuration is maybe not optimal for the amount of users.
Is there any advice how the cache-container should be configured?

We modified <expiration lifespan="-1"/> to <expiration lifespan="3600000"/>

We suspect that the memory will continue to grow exponential with the lifespan = “-1” configuration.
Does it make sense to set the livespan to a fixed value like 1h?

What are your experiences?

Our new configuration looks like this.


 <cache-container name="keycloak">
    <!-- custom stack must be referenced by name in the stack attribute of the transport element -->
    <transport lock-timeout="60000" stack="jdbc-ping-tcp"/>
    <local-cache name="realms">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <memory max-count="10000"/>
    </local-cache>
    <local-cache name="users">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <memory max-count="0"/>
      <expiration lifespan="3600000"/>
    </local-cache>
    <distributed-cache name="sessions" owners="2">
      <expiration lifespan="3600000"/>
    </distributed-cache>
    <distributed-cache name="authenticationSessions" owners="2">
      <expiration lifespan="3600000"/>
    </distributed-cache>
    <distributed-cache name="offlineSessions" owners="2">
      <expiration lifespan="3600000"/>
    </distributed-cache>
    <distributed-cache name="clientSessions" owners="2">
      <expiration lifespan="3600000"/>
    </distributed-cache>
    <distributed-cache name="offlineClientSessions" owners="2">
      <expiration lifespan="3600000"/>
    </distributed-cache>
    <distributed-cache name="loginFailures" owners="2">
      <expiration lifespan="3600000"/>
    </distributed-cache>
    <local-cache name="authorization">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <memory max-count="0"/>
      <expiration lifespan="3600000"/>
    </local-cache>
    <replicated-cache name="work">
      <expiration lifespan="3600000"/>
    </replicated-cache>
    <local-cache name="keys">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <expiration max-idle="3600000"/>
      <memory max-count="1000"/>
    </local-cache>
    <distributed-cache name="actionTokens" owners="2">
      <encoding>
        <key media-type="application/x-java-object"/>
        <value media-type="application/x-java-object"/>
      </encoding>
      <expiration max-idle="3600000" lifespan="3600000" interval="300000"/>
      <memory max-count="-1"/>
    </distributed-cache>
  </cache-container>

Thx and best regards
David

Dear David,

Is there any news on this issue?
We are facing the same problem https://keycloak.discourse.group/t/infinispan-timeout/27651

Thanks in advance,

Aris