Explain eventual consistency in context of NoSQL

Technology CommunityCategory: NoSQLExplain eventual consistency in context of NoSQL
VietMX Staff asked 3 years ago

Think about Eventual consistency (as opposed to Strict Consistency/ACID compliance) as:

  1. Your data is replicated on multiple servers
  2. Your clients can access any of the servers to retrieve the data
  3. Someone writes a piece of data to one of the servers, but it wasn’t yet copied to the rest
  4. A client accesses the server with the data, and gets the most up-to-date copy
  5. A different client (or even the same client) accesses a different server (one which didn’t get the new copy yet), and gets the old copy

Basically, because it takes time to replicate the data across multiple servers, requests to read the data might go to a server with a new copy, and then go to a server with an old copy. The term “eventual” means that eventually the data will be replicated to all the servers, and thus they will all have the up-to-date copy.

Eventual consistency is a must if you want low latency reads, since the responding server must return its own copy of the data, and doesn’t have time to consult other servers and reach a mutual agreement on the content of the data.

The reason why so many NoSQL systems have eventual consistency is that virtually all of them are designed to be distributed, and with fully distributed systems there is super-linear overhead to maintaining strict consistency (meaning you can only scale so far before things start to slow down, and when they do you need to throw exponentially more hardware at the problem to keep scaling).