Alpit Anand
Alpit Anand

Reputation: 1258

How to have absolute consistency in Cassandra?

I have been defining a data model schema for bank(pet project), where I came across a edge case where 2 person simultaneously tries to credit and debit money in a account.

I thought of using Quorom level consistency but I don't think it will work, for simultaneous transaction.

Any help appreciated Thanks

Upvotes: 0

Views: 112

Answers (1)

Saifallah KETBI
Saifallah KETBI

Reputation: 313

If you use QUORUM consistency level your data will be consistent, but not for your edge case. It doesn't handle the concurrency and isolation for your case and the last write will win.

Cassandra doesn't have transaction system like other relational database, if this your case is the your heart of the system that you need that to scale, maybe you have to consider another technology.

You might be interested in using lightweight transactions(LWT), that can help you to achieve what you want. but be aware of performance of it, because the paxos algorithm used in it make all node communicate to handle that.

This is an article explaining LWT : https://www.datastax.com/blog/2013/07/lightweight-transactions-cassandra-20

I hope this help.

Upvotes: 1

Related Questions