Mandroid
Mandroid

Reputation: 7524

Cassandra: Low availability for higher consistency

Cassandra offers tunable consistency. So if user asks for higher level of consistency, proportionately more nodes would need to respond before success response is returned. It is also well documented that higher consistency also means lower availability.

So whats the reason behind this lower availability as consistency rises? Does a node get blocked when a write is in progress, and hence not available for other operations?

Upvotes: 2

Views: 97

Answers (2)

Manish Khandelwal
Manish Khandelwal

Reputation: 2310

Consider a case where you have a three node cluster. As a client you decide to read/write with consistency level quorum. This requires acknowledgement from two nodes. It means you can read/write to your cluster even when one node is down in the cluster.

Now you decide to read/write with consistency ALL. This require all 3 nodes to acknowledge. It means you need all 3 nodes to be up for successful read or write.

Thus increasing consistency level from quorum to ALL resulted in reduced availability of the cluster. If you reduce Consistency to ONE, you can afford two nodes down. Thus reducing consistency level resulted in increased availability of the cluster.

Upvotes: 2

pveentjer
pveentjer

Reputation: 11402

For the theory behind it, look for the CAP-theorem. In short: in case of a network partition, you need to make a trade-of between availability (every request gets a non error response) and consistency; you can't have both.

If you want increased consistency level, you need to increase the replication factor so that that you need more ACK's for a read/write to be considered a success.

If too many machines fail, it isn't possible to have a sufficient number of ACK's and the operation completes with an error-response and as a consequence the system becomes unavailable.

Upvotes: 2

Related Questions