How does Hazelcast MultiMap determine the owner of a key?

314 views
Skip to first unread message

yukai wei

unread,
Feb 14, 2012, 8:06:46 AM2/14/12
to Hazelcast
In the pdf:
*Q. How does Hazelcast determine the owner of a key?*
Hazelcast creates fixed number of virtual partitions (blocks).
Partition
count is set to 271 by default. Each key falls into one of these
partitions.
Each partition is owned/managed by a member. Oldest member of the
cluster
will assign the ownerships of the partitions and let every member know
who
owns which partitions. So at any given time, each member knows the
owner
member of a each partition. Hazelcast will convert your key object to
com.hazelcast.nio.Data then calculate the partition of the owner:
partition-of-the-key
= hash(keyData) % PARTITION_COUNT. Since each member(JVM) knows the
owner of
each partition, each member can find out which member owns the key.

but how does Hazelcast MultiMap determine the owner of a key?

Fuad Malikov

unread,
Feb 14, 2012, 8:33:11 AM2/14/12
to haze...@googlegroups.com
In exactly the same way. A key doesn't metter if it is for Map or Multimap will be owned by the same member. 

-fuad



--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To post to this group, send email to haze...@googlegroups.com.
To unsubscribe from this group, send email to hazelcast+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/hazelcast?hl=en.


yukai wei

unread,
Feb 15, 2012, 8:44:49 AM2/15/12
to Hazelcast
For examples: i load all records in a file into MultMap ,key is file
name ,values are records
there are four nodes in cluster,
the key is same, how the MultiMap distributed evenly?
the data in one node or one node carry 1/4 datas

Fuad Malikov

unread,
Feb 15, 2012, 10:41:38 AM2/15/12
to haze...@googlegroups.com
All values associated to a key on multimap are stored all together. 

Say you have two keys in multimap A and B. A has 10 entries on value and B has 10000 entries. Hazelcast will distribute the keys and all values associated to it. The owner of A will hold all 10 values and the owner of B all 10000. 
Reply all
Reply to author
Forward
0 new messages