Hi
Hazelcast is designed to work with huge volumes of data and multiple nodes. At smaller volumes, 1 node with 4 entries, it can be less obvious what is going on.
"loadAllKeys()" is called on 1 node in the cluster, regardless of the cluster.
The collection returned is split first by partition count (default 271) and then by "hazelcast.map.load.chunk.size" system property.
What is likely happening is your 4 keys belong in 4 different partitions, so the first split negates the need for the second.
Hazelcast uses partitioning to shard the map storage. Each node in the cluster looks after a share of the shards.
What happens here is that "loadAllKeys()" runs on 1 node in the cluster. You have only 1 node anyway.
The collection is returns is then split into one collection per shard, and these collections are sent to the nodes that own these collections.
So the main loading is split across all nodes in the cluster and happens in parallel. /*This makes loading faster so long as the RDBMS can cope with this parallel query load.*/
You have only 1 node, so this part is not obvious, but your logging may show different thread names being used.
If the collection for any one partition is larger than the chunk size, it is done in batches, to ease the pressure on the RDBMS.
You can confirm this in a few ways
(1) use "hazelcastInstance.getPartitionService().getPartition(K)" to find which partitions your entries would be stored in.
Partitions are managed by separate threads, depending on the CPUs, so if the data spreads across multiple threads the access rate can go up.
(2) try a 2 node cluster, or more nodes. "loadAllKeys()" will still run on one node, but "loadAll(Collection<K>)" will run in parallel across all nodes.
(3) for your existing set-up, for one test, set "hazelcast.partition.count" system property to "1". All keys will be in the same partition, as there's
only 1. And you'll see a batch of 4 passed to "loadAll(Collection<K)". Don't forget to remove that property after!
Neil