debop/hibernate-redis

Usage of hibernate-redis on clustered enviroment

leolimajr opened this issue · 1 comments

Hi,

Have you ever used hibernate-redis on a cluster environment? I'm seeing cache size grow insanely and keys never being expired despite a TTL being defined.

Am I doing something wrong? I suspect that EvictionScheduler (redisson) is not working welll on clustered setups. But I'm not sure.

Im using the 2.3.2 version.

datasource config

<prop key="hibernate.cache.use_second_level_cache">true/prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.default_cache_concurrency_strategy">read-write</prop>
<prop key="hibernate.cache.region_prefix">foobar</prop>
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.redis.hibernate4.SingletonRedisRegionFactory</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">hibernate-redis.properties</

hibernate-redis.config

redisson-config=classpath:redisson.yaml
redis.expiryInSeconds.default=900

redisson.yaml

sentinelServersConfig:
 idleConnectionTimeout: 10000
 pingTimeout: 1000
 connectTimeout: 10000
 timeout: 3000
 retryAttempts: 3
 retryInterval: 1500
 reconnectionTimeout: 3000
 failedAttempts: 3
 clientName: "shop"
 loadBalancer: !<org.redisson.connection.balancer.RoundRobinLoadBalancer> {}
 slaveConnectionMinimumIdleSize: 10
 slaveConnectionPoolSize: 64
 masterConnectionMinimumIdleSize: 10
 masterConnectionPoolSize: 64
 readMode: "MASTER"
 sentinelAddresses: ["redis://foo.bar.net:12345"]
 masterName: "my-cache"
codec: !<org.redisson.codec.FstCodec> {}

@debop: Is it still an issue. Say if we have multiple tomcat servers and if we use hibernate redis for L2 cache. Is it handled or no? I do see on slack over flow there are few comments around it, but want to check?
https://stackoverflow.com/questions/7650129/redis-as-hibernate-second-level-cache/17932838#comment60964066_18479432