The Cosmos DB consistency levels

In distributed databases, consistency is a very important factor. You need to decide the level of urgency and the importance of the data in your application to figure out the consistency.

Cosmos DB provides five consistency levels:

  1. Strong: This consistency level guarantees that a write operation is only visible to the application or consumer of data when it is committed by the majority of the replicas. This increases the cost of the read operation.
  2. Bounded staleness: In this consistency level, the read operation may lag behind the write operation. In simpler words, this is the best-suited consistency level for distributed databases because of the low-cost read operation and low latency.
  3. Session: As the name suggests, session consistency is bound to the client session. Each session or user session, to be specific, guarantees the monolithic read and write.
  4. Consistent prefix: In this level, the read operation will return the data in the sequence in which it was written. If it was written as A, B, and C, then read will return either A, AB, ABC but not BA or BC.
  5. Eventual: This is the weakest consistency level. In this, the client may see the data which is an older version and without an order. This is very cost effective but not suitable for mission-critical applications.

You can always choose consistency levels for each Cosmos DB from the data explorer menu.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.254.7