Discussion:
Consistency Level (QUORUM vs LOCAL_QUORUM)
Harikrishnan A
2016-03-27 22:36:36 UTC
Permalink
Hello,

I have a question regarding consistency Level settings in a multi Data Center Environment.  What is the preferred CL settings in this scenario for an immediate consistency , QUORUM or LOCAL_QUORUM ?
If the replication Factor is set to 3  each ( 2 Data Centers) , the QUORUM ( writes/read) waits for 2 consistent response from nodes across the cluster ( out of total 6 replications) , where as LOCAL_QUORUM expects 2 consistent response from 3 replicas within that LOCAL data Center.  If my above understanding is correct, does that mean QUORUM doesn't guarantee Immediate consistency ( in this multi Data Center Scenario) where as LOCAL_QUORUM does guarantee the immediate consistency.

Thanks & Regards,Hari
Jack Krupansky
2016-03-28 03:44:58 UTC
Permalink
The third choice is EACH_QUORUM which assures QUORUM in each data center
(all data centers.)

There is no "immediate consistency" per se in Cassandra. Cassandra offers
"eventual consistency" and "tunable consistency" or the degree of immediate
consistency, which is the CL that you specify - you specify the degree of
immediate consistency that you require. If you want the full immediate
consistency of a traditional relational database, then go with CL=ALL,
otherwise, take your pick from the many degrees of immediacy that Cassandra
offers:
http://docs.datastax.com/en/cassandra/3.x/cassandra/dml/dmlConfigConsistency.html
.

In short, Cassandra does indeed guarantee the degree of immediate
consistency that you specify (and presumably want.)


-- Jack Krupansky
Post by Harikrishnan A
Hello,
I have a question regarding consistency Level settings in a multi Data
Center Environment. What is the preferred CL settings in this scenario for
an immediate consistency , QUORUM or LOCAL_QUORUM ?
If the replication Factor is set to 3 each ( 2 Data Centers) , the QUORUM
( writes/read) waits for 2 consistent response from nodes across the
cluster ( out of total 6 replications) , where as LOCAL_QUORUM expects 2
consistent response from 3 replicas within that LOCAL data Center. If my
above understanding is correct, does that mean QUORUM doesn't guarantee
Immediate consistency ( in this multi Data Center Scenario) where as
LOCAL_QUORUM does guarantee the immediate consistency.
Thanks & Regards,
Hari
Alain RODRIGUEZ
2016-03-31 11:35:00 UTC
Permalink
Hi,

If you want the full immediate consistency of a traditional relational
database, then go with CL=ALL, otherwise, take your pick from the many
My understanding is using RF 3 and LOCAL_QUORUM for both reads and writes
will provide a strong consistency and a high availability. One node can go
down and also without lowering the consistency. Or RF = 5, Quorum = 3,
allowing 2 nodes node if you need more availability / redundancy (Never saw
that in use so far). I prefer this to ALL, that will produce the cluster to
be partially unavailable any time a node is down (crash or just a node
restart). I also never saw anyone using CL = ALL so far, for this exact
reason I believe.

Writing to 2 nodes out of 3 and reading from 2 nodes out of 3 --> using RF
= 3 / R&W CL = LOCAL_QUORUM, will give a strong and (almost) immediate
consistency. Remember there is no lock though, so immediate = as soon as
write succeed on enough nodes, 2 in our case).

If you need a strong consistency and are reading the same data in the 2
DCs, consider using EACH_QUORUM as Jack mentioned earlier.

Also, when using 2 datacenter, make sure to pin clients to one DC. Else you
might perform LOCAL_QUORUM operations on any of the 2 DCs, which would
remove the strong consistency.

More information about this last point on step 4 there:
https://docs.datastax.com/en/cassandra/2.1/cassandra/operations/ops_add_dc_to_cluster_t.html

About consistency
https://wiki.apache.org/cassandra/ArchitectureOverview#Consistency.

C*heers,
-----------------------
Alain Rodriguez - ***@thelastpickle.com
France

The Last Pickle - Apache Cassandra Consulting
http://www.thelastpickle.com
The third choice is EACH_QUORUM which assures QUORUM in each data center
(all data centers.)
There is no "immediate consistency" per se in Cassandra. Cassandra offers
"eventual consistency" and "tunable consistency" or the degree of immediate
consistency, which is the CL that you specify - you specify the degree of
immediate consistency that you require. If you want the full immediate
consistency of a traditional relational database, then go with CL=ALL,
otherwise, take your pick from the many degrees of immediacy that Cassandra
http://docs.datastax.com/en/cassandra/3.x/cassandra/dml/dmlConfigConsistency.html
.
In short, Cassandra does indeed guarantee the degree of immediate
consistency that you specify (and presumably want.)
-- Jack Krupansky
Post by Harikrishnan A
Hello,
I have a question regarding consistency Level settings in a multi Data
Center Environment. What is the preferred CL settings in this scenario for
an immediate consistency , QUORUM or LOCAL_QUORUM ?
If the replication Factor is set to 3 each ( 2 Data Centers) , the
QUORUM ( writes/read) waits for 2 consistent response from nodes across the
cluster ( out of total 6 replications) , where as LOCAL_QUORUM expects 2
consistent response from 3 replicas within that LOCAL data Center. If my
above understanding is correct, does that mean QUORUM doesn't guarantee
Immediate consistency ( in this multi Data Center Scenario) where as
LOCAL_QUORUM does guarantee the immediate consistency.
Thanks & Regards,
Hari
Robert Coli
2016-03-31 18:11:27 UTC
Permalink
Post by Alain RODRIGUEZ
My understanding is using RF 3 and LOCAL_QUORUM for both reads and writes
will provide a strong consistency and a high availability. One node can go
down and also without lowering the consistency. Or RF = 5, Quorum = 3,
allowing 2 nodes node if you need more availability / redundancy (Never saw
that in use so far).
I agree that if one "actually" cared about TOTAL AVAILABILITY one would run
RF=5.

In that case, one can survive a "permanent" downtime (node hw crashes) and
a "temporary" downtime (momentary network partition of node) and still
serve at QUORUM.

I also agree that I've never seen anyone actually do this, probably because
they don't "actually" care... :D

=Rob

Loading...