Pergunta

I am just on the way writing my bachelor thesis. So therefore I am concerned with Eventually Consistency in theory and how Cassandra applies this theory. To understand my problem, consider the following definitions of consistency (as far as I understood):

  • Causal Consistency:

    A system provides causal consistency if memory operations that potentially are causally related are seen by every node of the system in the same order. (wikipedia)

    So if a Process A writes a data X into the DB and after that a process B reads this data X and overwrites this with Y, then we say that a Causal Consistency is ensured if B gets X after A on all replicas (resp. nodes).

  • Read-your-write Consistency:

    This is a special case of Causal Consistency. Hereby the reading and writing is processed on the same process A. This type of consistency ensures that A will never have an older object of data after the modification.

  • Session Consistency:

    In this case a process A accesses the DB in a Session. As long as this Session exists, the system guarantess you a Read-your-write Consistency

  • Monotonic Read Consistency:

    If a process gets a specific data object after reading, the system guarantees that a process on every subsequent Read-Access won't get an older data object.

  • Monotonic Write Consistency:

    In this case the Write options to the DB will be done serialised whereby the order of the write options results which process came first to write.

    Now that are some Consistency options in theory which some or one of them is implemented in the NoSQL-system. But please correct me if I understood something wrong.

My question is which type of Consistency is provided by CASSANDRA? And how are these Consistencys related to the Rule "R+W>N" respectively "R+W<=N"

whereby 
R=read replica count 
W=write replica count 
N=replication factor

I'd really appreciate a quick answer. Thank You!!!
Foi útil?

Solução

Consistency levels in Cassandra can be set on any read or write query. This allows application developers to tune consistency on a per-query basis depending on their requirements for response time versus data accuracy. Cassandra offers a number of consistency levels for both reads and writes.

You should first understand about QUOROM

QUORUM is a good middle-ground ensuring strong consistency, yet still tolerating some level of failure.

A quorum is calculated as (rounded down to a whole number):

(replication_factor / 2) + 1

For example, with a replication factor of 3, a quorum is 2 (can tolerate 1 replica down). With a replication factor of 6, a quorum is 4 (can tolerate 2 replicas down).

For your question the explanation is given below

(nodes_read + nodes_written) > replication_factor

R + W > N

For example, if your application is using the QUORUM consistency level for both write and read operations and you are using a replication factor of 3, then this ensures that 2 nodes are always written and 2 nodes are always read. The combination of nodes written and read (4) being greater than the replication factor (3) ensures strong read consistency

You can read more about Quorom and consistency in detail in the link posted below

http://www.datastax.com/docs/1.1/dml/data_consistency

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top