Consistency Level (CL)

2 min to complete

Consistency Level (CL)

The number of nodes that must acknowledge a read or write operation before it is considered successful.

For data to be successfully written or read back to the client,  a sufficient number of nodes need to agree on the data’s correct state. Note that while you can set consistency levels for all operations (on the client-side), Scylla allows each operation (each read or write) to have its own consistency level, a feature known as tunable consistency.

  • CL of 1: Wait for a response from one replica node
  • CL of ALL:  Wait for a response from all replica nodes
  • CL LOCAL_QUORUM:  Wait for floor((#dc_replicas/2)+1), meaning that if a DC has 3 nodes replica in the cluster, the application will wait for a response from 2 replica nodes
  • CL EACH_QUORUM: For multi DC, each DC must have a LOCAL_QUORUM. This is unsupported for reads.
  • CL ALL: All replica nodes must respond. Provides the highest consistency but lowest availability.

Because data may have changed on a coordinator node, but it may not have yet been recorded and stored on all the required replicas, a Scylla cluster offers eventual consistency. With eventual consistency, all of the replica nodes will eventually arrive at the same data state; operations may continue updating the database in the meantime.

More information about high availability,  replication, and consistency can be found in this lesson.

fa-angle-up