-
1. Re: Caching in WildFly
pferraro May 6, 2019 10:35 AM (in response to valsaraj007)1 of 1 people found this helpfulTake a look at the cache expiration configuration of the various cache regions of your second-level cache. I would guess that your expiration configuration does not match your expectations.
-
2. Re: Caching in WildFly
valsaraj007 May 7, 2019 4:44 AM (in response to pferraro)pferraro Thanks!
The default settings with WildFly is used without much changes. There is no other cache regions added.
<cache-container name="hibernate" default-cache="local-query" module="org.hibernate">
<transport lock-timeout="120000"/>
<local-cache name="local-query">
<locking isolation="READ_COMMITTED"/>
<transaction mode="NONE" locking="OPTIMISTIC"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<invalidation-cache name="entity" mode="SYNC">
<locking isolation="READ_COMMITTED"/>
<transaction mode="NON_XA" locking="OPTIMISTIC"/>
<eviction strategy="LRU" max-entries="10000"/>
<expiration max-idle="100000"/>
</invalidation-cache>
<replicated-cache name="timestamps" mode="ASYNC">
<locking isolation="READ_COMMITTED"/>
<transaction mode="NONE" locking="OPTIMISTIC"/>
<eviction strategy="NONE"/>
</replicated-cache>
</cache-container>
Currently in 2 hours he same lag occurred when tested. Which settings need to be adjusted to control cache expiration?
Here is the L2C metrics printed during the operation:
[Server:ltchie-node-00] 20:24:59,495 INFO [org.hibernate.engine.internal.StatisticalLoggingSessionEventListener] (default task-8) Session Metrics {
[Server:ltchie-node-00] 15330440 nanoseconds spent acquiring 48 JDBC connections;
[Server:ltchie-node-00] 4266808 nanoseconds spent releasing 48 JDBC connections;
[Server:ltchie-node-00] 16230818 nanoseconds spent preparing 48 JDBC statements;
[Server:ltchie-node-00] 47383156 nanoseconds spent executing 48 JDBC statements;
[Server:ltchie-node-00] 0 nanoseconds spent executing 0 JDBC batches;
[Server:ltchie-node-00] 96615 nanoseconds spent performing 1 L2C puts;
[Server:ltchie-node-00] 1512024 nanoseconds spent performing 28 L2C hits;
[Server:ltchie-node-00] 1162267 nanoseconds spent performing 28 L2C misses;
[Server:ltchie-node-00] 913458 nanoseconds spent executing 1 flushes (flushing a total of 52 entities and 228 collections);
[Server:ltchie-node-00] 15298375 nanoseconds spent executing 31 partial-flushes (flushing a total of 712 entities and 712 collections)
[Server:ltchie-node-00] }
-
3. Re: Caching in WildFly
pferraro May 10, 2019 7:37 AM (in response to valsaraj007)1 of 1 people found this helpfulSo, according to your configuration, queries, entities, and collections will only be retained in memory for 100 seconds, unless accessed. Does this match your expectations?
-
4. Re: Caching in WildFly
valsaraj007 May 10, 2019 9:29 AM (in response to pferraro)No, I think it should be higher. So the existence of an entry in local hibernate cache depends on max-entries & max-idle.
-