Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hazelcast 3.6.2 Eviction Map not working with Spring and max-size-policy as PER_NODE in 3.6.2

I want to get Map eviction max-size="4" PER_NODE working on Hazelcast 3.6.2 spring. This beneath is my map defined in spring.

<hz:map name="sfdRequestMap" in-memory-format="OBJECT" eviction-policy="LRU" max-size="4" max-size-policy="PER_NODE" eviction-percentage="25">
</hz:map>

I've also checked if this eviction policy is actually set for the map defined and it is. Also evict after seconds works for that map, but eviction on overriding max size doesn't. I am using hazelcast 3.6.2. I've also tried removing in-memory-format, changing eviction policy etc etc.

Expected behavior is that when the map exceeds the amount of items (more then 4) the eviction would start. The actual behaviour is that the eviction never starts.

Any help is welcome.

like image 515
jobbert Avatar asked Sep 15 '25 06:09

jobbert


1 Answers

Hazelcast Map internally does eviction on partition basis, that means when you use PER_NODE policy with a maxSize of 5000, it translates that maxSize to partition-max-size by using this equation partition-max-size = maxSize * memberCount / partitionCount. And when entry-count in that partition exceeds partition-max-size, eviction starts on that partition. Min value for partition-max-size is internally set 1 not to evict every added entry. So partitionCount is the minimum settable max-size (default partition-count is 271).

like image 117
mrck Avatar answered Sep 17 '25 21:09

mrck