1
votes

I've read about CAP theorem and NoSQL data eventual consistency problem. As I understand you can achieve full consistency or full availability but never both. So if you get more performance you may get stale data / partial transactions. And as I understand there is no solution so far for clustered data storage.

In the other hand Hazelcast claims it enforce full consistency for IMap.

Question: How do Hazelcast enforce full data consistency? Is that possible because it based on RAM and may not care about availability (means availability is provided anyway)?

1

1 Answers

3
votes

I can just answer for Hazelcast. We have the data partitioned, that means we serialize the key, take the hashcode of the serialized byte-array and make a mod with the partitionCount.

partitionId = hashcode(serialize(key)) % partitionCount

Every partitionId is now registered to a single node (+ backup nodes). If you have mutating operations for a given key this operation is send to the owner of the partition and he applies one operations after the other. Therefore you always have a consistent view per partition and get operations are enqueued just as everything else, so for a single partition there is no chance to see staled data.

If you use near-caches, for sure you end up in a slightly timewindow where the owner already have applied a mutation but the near-caches are not yet invalidated (network latency).

I hope this answers your question :)