Database Reference
In-Depth Information
Write consistency
Let's inspect the write operation a little closely in Cassandra. Well, when a write operation
is done in Cassandra, the client can specify the consistency at which the operation should
be performed.
This means that if the replication factor is x and a write operation is performed with a con-
sistency of y (where y is less than x), then Cassandra will wait for successful write to com-
plete on y nodes before returning a successful acknowledgement to the client, marking the
operation as complete. For the remaining x-y replicas, the data is propagated and replicated
internally by the Cassandra processes.
The following table shows the various consistency levels and their implication where we
have ANY that has the benefit of the highest availability with the lowest consistency, and
ALL that offers the highest consistency but the lowest availability. So, being a client, one
has to review the use case before deciding upon which consistency to choose. The follow-
ing is a table with a few popular options and their implications:
Consistency
level
Implication
The write operation is returned as successful when the datum is written onto at least one node, where the node could either be a
replica node or a non-replica node
ANY
ONE
The write operation is returned as successful when the datum is written onto at least one replica node
TWO
The write operation is returned as successful when the datum is written onto at least two replica nodes
The write operation is returned as successful when the datum is written to the quorum of the replica node (where the quorum is
n/2+1, and n is the replication factor)
QUORUM
ALL
The write operation is returned as successful when the datum is written onto all replica nodes
The following figure depicting the write operation on a four-node cluster, which has a rep-
lication factor of 3 and consistency of 2 :
Search WWH ::




Custom Search