Page 70 - Building Big Data Applications
P. 70

64 Building Big Data Applications


             user interaction and keep the consistency, Cassandra provides a model called tunable
             consistency. In this model, the client application decides the level of consistency desired
             by that application. This allows the user the flexibility to manage different classes of
             applications at different levels of consistency. There are additional built-in repair
             mechanisms for consistency management and tuning. A key point to remember is
             consistency depends on replication factor implementation in Cassandra.

             Write consistency
             Since consistency is a configuration setting in Cassandra, a write operation can specify
             its desired level of consistency. Cassandra lets you choose between weak and strong
             consistency levels. The following consistency levels are available.
             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 rowkey are
                       down, the write can still succeed once has been
                       written by storing the hint and the data in the
                       coordinator
                       Not a preferred model
                       Notedif all replica nodes are down an ANY
                       write will not be readable until the replica
                       nodes for that rowkey have restored
             ONE       A write must be written to the commit log and  Returns a response from the closest replica
                       memory table of at least one replica node
             QUORUM    A quorum is defined as the minimum number of replicas that need to be available for a successful
                       read or write
                       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 quorumda 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 quorumda 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  Data is returned once all replicas have responded.
                       log and memory table on all replica  The read operation will fail if a replica does not
                       nodes in the cluster for that row key  respond.
                       The highest and strongest level of
                       consistency brings latencies in the architecture
                       Not a preferred method until complexity and
                       volumes are low
   65   66   67   68   69   70   71   72   73   74   75