1
votes

Say I have following configuration for a Hazelcast map

No. of nodes in cluster: 1
Map Configurations:
max-size:100MB
sync-backup-count: 1
async-backup-count: 0

If I make a map.put(...) call with 20 unique keys (each entry taking 1 MB), what will be the map memory consumed ?

Is memory usage of backup entries also considered as part of max-size ?

1
When you have 1 node, the backups will not be created. For more nodes, assuming you set USED_HEAP_SIZE max-size policy, you will have 100MB primary and 100MB backup memory usage. You can observe the primary and backup partition usage using Management Center.Ozan Kılıç

1 Answers

2
votes

If you have less nodes than you have data copies requested, you can't get all the data copies requested.

For example, backup-count=2 requests 3 data copies, the primary and two backups. If there are only 2 nodes then you can't host the 2nd backup anywhere. It makes no sense for a node to host more than one copy - the point of this is data safety, a node failure should only result in one copy being lost.

If you write 20 entries of 1MB, then that's 20MB per copy. You have 1 node so 1 copy so 20MB.

You won't have any backup copies as there's nowhere to host them. But if you did, they're included in the max size calculation.

For your example, if you had 4 nodes, 1 backup (2 copies in total) and 20 entries, you would expect each node to have 5 of the primary copy entries and 5 of the backup copy entries, so have 10MB of data. 40MB of data spread across 4 nodes. The actual allocation depends on the keys, which might not be uniform.

You can confirm all this with the management center. That's not a bad idea as often what is thought to be a 1MB entry actually has a different size once serialized and allowing for entry overhead.

This https://docs.hazelcast.org/docs/4.0/manual/html-single/index.html#map-eviction explains how eviction works.