Infinispan does not provide any memory-based eviction yet.
Infinispan uses a concurrent hash map that splits the hash space in segments (a.k.a. buckets) and each segment evicts it owns entries independently.
So, when you set the maxEntries=2000
, internally, the concurrent hash map is creating segments with capacity maxEntries/numberSegments
. When a segment is full, the eviction is trigger in that segment and removes an entry.
In your case, some segments are full quickly and before you reach the 2000 entries.
You can try the following:
- increase the concurrency level (in
<locking concurrencyLevel="yyy">
, default 16). The number of segments increases with the concurrency level - try to implement a better
hashCode()
function to make a better spread of they keys.
Cheers.