I have a card with an ice card, defined as follows, where approx. 1 million records.
IMap<Integer, Employee> employeeMap = hazelcastInstance.getMap("employeeMap");
employeeObj.isCool()
returns whether the given employee is “cool” or not.
I need a mechanism to find all the cool employees from employeeMap
. I understand that I can do one of the following.
Option 1 : a call employeeMap.keySet(predicate);
that will be executed in parallel in each of the cluster members and will be connected by the caller using the fork / join mechanism.
Question 1 . However, I think this will load the recordsets in each node into memory at a time before applying the predicate to each of the records. Please confirm.
Option 2 : employeeMap.executeOnEntries(entryProcessor);
where the entrypcessor method process()
will be next.
@Override
public Object process(Entry<Integer, Employee> entry)
{
return entry.getValue().isBad() ? true : null;
}
Question 2 : I understand what EntryProcessor
works in a section thread. I would like to know if it will load (deserilaize) all local records in the local node in one-go (and temporarily store) before the method is called process()
.
Question 3 . I would like to know the best available option (in terms of the complexity of time and space) and the rationale for it.
source
share