2

I'm reading about eventual consistency in couchDB. I'm somewhat confused by the term and its consequences on an application.

Let's say I'm building a distributed e-commerce website where monetary transactions are critical. There could be online auctions running and people bidding on them in real time. Will using a eventual consistent DB such as couchDB be a wrong solution? Should I favor a more consistent solution such as a relational database?

Is couchDB suitable for something non critical such as a social network where one wouldn't mind if his news feed isn't up to date or when comments on his posts are somewhat delayed by few seconds?

Update

I'm talking about building a distributed system. I think in case of a single server nothing of this will matter.

6
  • 1
    "real time" and "eventual" don't sound like they mix well... Commented Jan 26, 2014 at 16:38
  • 1
    will the IRS be ok with "eventually consistent" Accounting practices?
    – Mike Graf
    Commented Jan 26, 2014 at 17:08
  • IMHO - a bid is not the same as a bank wire transaction. It's a "potential" monetary transaction. Is using both an option?
    – JeffO
    Commented Jan 27, 2014 at 15:26
  • Eventual consistency is really good for recording transactions, where there will be no concurrency in writing. If you have concurrency in writing, then it can still work, but is not quite so simple. Commented Jan 27, 2014 at 15:33
  • @JeffO well I'm still trying to discover what couchDB could be used for. I hear a lot of people talking about how couchDB is better for distributed systems, but I don't know why. How could one use a hybrid approach?
    – Songo
    Commented Jan 27, 2014 at 15:34

2 Answers 2

2

The eventual consistency part has to do with distributed systems-- that is, when there is more than one copy of the data and it needs to be consistent. It's basically the difference between synchronous and asynchronous replication.

So, it's not an issue if you have a single server. It's also not an issue if your system (Couch) has a synchronous mode of operation.

There's also no guarantee that conventional databases wouldn't succumb to this problem (think MySQL replication where slaves are lagging behind the master).

So the answer to your question is: it depends.

1
  • To be specific, in a real distributed system, it's more like multi-master replication where different writes could be going to different servers, and less like conventional master-slave replication where all writes go to a single server. Commented Jan 27, 2014 at 17:26
0

Think of it this way:

You can use eventual constancy to record and capture each users bids. The fact that the database will take a few mSec to share the bids around is not material.

You can also have a stand alone process that decides which auctions have finished, and which bid won each auction. This process needs to allow a few seconds for eventual consistency to complete so that it is highly likely to have a complete view of all bids. However its decision needs to be final.

The users then can see who has been awarded the auction as per normal. The fact that some users may see this a few mSec earlier than the others again is not material, the key is that if they keep refreshing their page (or receive push messages) they will see it when the replication has made it to their database server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.