question

rajib76 avatar image
rajib76 asked Erick Ramirez answered

Are there other techniques to achieve linearizable consistency in Cassandra?

I have a use case where I would need to read a certain value and update it. This operation can be done by multiple threads in parallel. So, when one thread is updating the value, I do not want the others to update the value. I understand the LWT is one way to achieve this in Cassandra. But at the same time, I understand that LWT is an expensive operation and in some situations may also lead to inconsistent data(where the data got updated but the operation timed out). I also heard(but not 100% sure) that it can go in loops if proposers start proposing a new value frequently.

I wanted to know if there are any other technique to achieve linearizable consistency in Cassandra

lightweight transactions
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

Lightweight transactions are the way to achieve the outcome you're after.

It seems like you've got some misunderstanding with the way it works so allow me to assist. Lightweight transactions are expensive because they require a read-before-write: it needs to perform a read to check that the condition can be satisfied before it can issue the write.

While this is taking place, the paxos algorithm ensures that only the latest proposal is accepted by all replicas and therefore no other proposal will be accepted until the transaction already in-flight has completed. This partition-level locking adds a penalty since no other request can update the partition concurrently. Cheers!

Share
10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.