How can I read a record back after I write to a NoSQL eventual consistency environment? For instance, I went to a large ecommerce site and after I placed an order, I got order confirmation page but when I clicked on the order number, I got order not found message, but worked fine after a minute, due to eventual consistency. How can I overcome that problem in a NoSQL environment like Cassandra?
I think that in your example, the problem was not in the real eventual consistency, but in the separation of the systems - quite often, order ID is generated by some subsystem, and then pushed into DB via some queue, or something like.
Talking about eventual consistency in Cassandra - in case if you want to have strong consistency, you can play with consistency settings of read & write operations. If you have R + W > RF
, then you achieve strong consistency. But this could be achieved different ways, depending on performance requirements - quite often people simply use QUORUM
for both reads & writes - in this case it will guarantee that you always get back the result that you wrote.