Understanding the five consistency levels

Now that we have multiple replicas of our data around the globe, what about data consistency? Cosmos DB provides the following five options:

  • Strong
  • Bounded staleness
  • Session
  • Consistent prefix
  • Eventual

In a replicated dataset, there is always a trade-off between consistency, availability, throughput, and latency. In theoretical computer science, Brewer's theorem (named after computer scientist Eric Brewer), also known as CAP Theorem, says that "a distributed database can only give two of the three guarantees; consistency, availability, partition tolerance". With this context in mind, Cosmos DB offers five different consistency levels, letting us fine-tune our priorities.

Keep in mind that high consistency ...

Get Guide to NoSQL with Azure Cosmos DB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.