Database Reference
In-Depth Information
sures all replica operations (read and write). This is where the so-called "tunable" consist-
ency of Cassandra lies. The following table shows all the consistency levels:
WRITE
READ
Consistency level Meaning
Consistency level Meaning
ZERO
Fire and forget
ANY
Success on hinted hand off write
ONE
First replica returned successfully ONE
First replica returned successfully
QUORUM
N/2 + 1 replica success
QUORUM
N/2 + 1 replica success
ALL
All replica success
ALL
All replica success
The notorious R + W > N inequality
Imagine that the value of your replication factor is three. This means your data will be
stored in three nodes. If you have a write consistency level as one, and a read consistency
level as one, they may or may not be consistent. Here is why: when a write happens, the
row mutation information is sent to all the nodes, but the user is returned a success mes-
sage as soon as the first replica responds with a success message. Meanwhile, the data is
being written to two other nodes. If a read request comes into those two nodes with a con-
sistency level one, they would return the stale data. Or, if it is a heavy write-read scenario,
all the three nodes may have different data at some instant of time, and read with CL=1,
which may result in inconsistent reads for a very brief time. The following figure shows
reads and writes, on an R + W > N system:
Search WWH ::




Custom Search