I just went through the hazelcast documentation.
It suggests that data partitioned across all the nodes.
And the number of partitions created in cluster 271 by default !
What parameters govern the selection of right partition count value. And why default partition count is 271 ?
Hazelcast distributes key objects into partitions (blocks) using a consistent hashing algorithm and those partitions are assigned to nodes. That means an entry is stored in a node which is owner of partition to that entry's key is assigned.
In Unified Intelligence Center, the default mechanism for Hazelcast cluster discovery or formation is UDP multicast. Unified Intelligence Center uses the Multicast group IP address 224.2.2.3 and port 54327.
271 is a prime number. And given any key, Hazelcast will hash the key and mod it with the partition count. In this context, prime numbers are believed to generate more pseudo-random result. Actually for user perspective, it is not that important to have it prime.
Then you may ask, why 271 but not other prime number.
Simply because 271 is a good number that will almost evenly distribute when you have less than 100 nodes. When you have more than 100 nodes, you need to increase it to make the distribution even.
Another reason to increase partition count is when you have large amount of data. Say you have 300 GB of data to be stored in data grid. Then each partition will have over 1GB and migration will take too long. Note that during migration, all updates to that partition are blocked. For sake of latency, you would like to have small data per partition. So increase it to a number where you are comfortable with the latency of moving partitions.
Note that partitions will migrate only when you add a new node.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With