Databases Reference
In-Depth Information
Table 4.2 Cassandra Consistency Levels
Consistency
Level
Write Consistency
Read Consistency
ANY
A write must be written to at least one node.
Not applicable
If a replica is down, a live replica or current node can store a
hint and update the node when it comes back live.
If all replica nodes for the given row key are down, the write can
still succeed once it has been written by storing the hint and
the data in the coordinator.
Not a preferred model.
Note: If all replica nodes are down an ANY write will not be
readable until the replica nodes for that row key have been
restored.
ONE
A write must be written to the commit log and memory table of
at least one replica node.
Returns a response from
the closest replica
QUORUM
A quorum is defined as the minimum number of replicas that need to be available for a
successful read or write.
A quorum is calculated as (rounded down to a whole number): (replication_factor/2)  +  1.
For example, with a replication factor of 5, a quorum is 3 (can tolerate 2 replicas down).
A quorum is a middle ground between weak and strong consistency.
A write must be written to the commit log and memory table on a quorum of replica nodes
to be successful.
Local quorum: A write must be written to the commit log and memory table on a quorum of
replica nodes in the same data center as the coordinator node.
Each quorum: A write must be written to the commit log and memory table on a quorum of
replica nodes in all data centers.
ALL
A write must be written to the commit log and memory table on
all replica nodes in the cluster for that row key.
Data is returned once all
replicas have responded.
The read operation will
fail if a replica does not
respond.
The highest and strongest level of consistency brings latencies
in the architecture.
Not a preferred method until complexity and volumes are low.
Hinted handoff. During a write operation, data is set to all replicas by default. If a node is down at
that time, data is stored as a hint to be repaired when the node comes back. If all nodes are down
in a replica, the hint and the data are stored in the coordinator. This process is called a hinted
handoff. No operation is permitted in the node until all nodes are restored and synchronized.
Cassandra ring architecture
Figure 4.26 shows the ring architecture we described earlier. In this configuration, we can visualize
how Cassandra provides for scalability and consistency.
In the ring architecture, the key is the connector to the different nodes in the ring, and the nodes
are replicas. For example, A can be replicated to B and C, when N = 3. And D can be replicated to D
and E or D and F when N = 2.
 
Search WWH ::




Custom Search