Reputation: 3507
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.
Upvotes: 4
Views: 2313
Reputation: 328
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).
Upvotes: 6