Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra immediate consistency with RF=2 and CL=1

I have a setup with RF=2 and all my read/writes are done with CL=1. There are few places where i open a session, write an entry, backend processin and read again. This mostly works but sometimes the read returns Nil. We are suspecting that the read's from the co-ordinator node goes to a node that is different from where the Write was done. My understanding is that a co-ordinator node sends the read request to both replica nodes and return the results correctly.

We are not worried about the updates to a row as most of the time we need immediate consistency only for newly created row's. We really don't need Quoram and the RF=2 is mostly for HA to tolerate the loss of one node. Any pointers on how to acheive immediate consistency with RF=2 and CL=1 is greatly appreciated.

like image 934
Chetan Avatar asked Nov 18 '25 11:11

Chetan


1 Answers

have a RF=3 with QUORUM would give you immediate consistency with ability to have single node loss. Anything less then that and its impossible to guarantee it as there will always be windows where one node sees mutation before other.

R + W > N  to have a consistent read/write.
R (number of nodes needed for read) + W (number of nodes needed for write) > N (number of nodes with data, RF)

with CL 1 on reads/writes and RF=2 you have 1+1 which is not > 2. You can use ALL, TWO or QUORUM on either read or write and you would get your consistency (only because rf=2 for TWO and QUORUM) but then any node failure will bring down abilities to do either reads or writes.

like image 101
Chris Lohfink Avatar answered Nov 21 '25 06:11

Chris Lohfink