I'm using Hazelcast 3.4 in a cluster with 5+ nodes. I have a map where keys are complex objects ( not primitive types). At any point of time, the size of the map may be around 200K.
I understand that the entries/values in a map will be stored in different partitions. However, I would like to know the following.
2 & 3 are follow up questions.
Is keySet() a distributed operation ? (i.e. will it surely involve remote machine communication in a cluster environment)
Is localKeySet() a distributed operation ?
Some more background on the problem:
I need to inform a third party program about the keys present in the hazelcast map in my program during regular intervals of time by calling a service cachedKeys(K[] keys) exposed by the third party program.
Option 1: call keySet() from any one of the nodes in the cluster to retrieve all the keys in the map and then call cachedKeys(K[] keys) service from that node.
Option 2: call localKeySet() from each of the nodes in the cluster to identify the local keys owned by each nodes, followed by cachedKeys(K[] keys) call from each node.
Above answers will help me to choose the right option.
Members do not maintain a global key set. Each member is aware of local entries only. Hence keySet() is a distributed operation hitting all members while localKeySet() is just a local operation. I hope this info helps you a bit.
Question got answered in google groups: Credits: Jaromir Hamala