Skip to content

Commit cbae514

Browse files
authored
Merge pull request #110532 from markjbrown/consistency-updates
Consistency level updates
2 parents 2b5c2a4 + 3b4f843 commit cbae514

File tree

2 files changed

+64
-29
lines changed

2 files changed

+64
-29
lines changed

articles/cosmos-db/consistency-levels-tradeoffs.md

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,58 @@ author: markjbrown
55
ms.author: mjbrown
66
ms.service: cosmos-db
77
ms.topic: conceptual
8-
ms.date: 07/23/2019
8+
ms.date: 04/06/2020
99
ms.reviewer: sngun
1010
---
1111

12-
# Consistency, availability, and performance tradeoffs
12+
# Consistency, availability, and performance tradeoffs
1313

1414
Distributed databases that rely on replication for high availability, low latency, or both must make tradeoffs. The tradeoffs are between read consistency vs. availability, latency, and throughput.
1515

16-
Azure Cosmos DB approaches data consistency as a spectrum of choices. This approach includes more options than the two extremes of strong and eventual consistency. You can choose from five well-defined models on the consistency spectrum. From strongest to weakest, the models are:
16+
Azure Cosmos DB approaches data consistency as a spectrum of choices. This approach includes more options than the two extremes of strong and eventual consistency. You can choose from five well-defined levels on the consistency spectrum. From strongest to weakest, the levels are:
1717

1818
- *Strong*
1919
- *Bounded staleness*
2020
- *Session*
2121
- *Consistent prefix*
2222
- *Eventual*
2323

24-
Each model provides availability and performance tradeoffs and is backed by comprehensive SLAs.
24+
Each level provides availability and performance tradeoffs and is backed by comprehensive SLAs.
2525

2626
## Consistency levels and latency
2727

28-
The read latency for all consistency levels is always guaranteed to be less than 10 milliseconds at the 99th percentile. This read latency is backed by the SLA. The average read latency, at the 50th percentile, is typically 2 milliseconds or less. Azure Cosmos accounts that span several regions and are configured with strong consistency are an exception to this guarantee.
28+
The read latency for all consistency levels is always guaranteed to be less than 10 milliseconds at the 99th percentile. This read latency is backed by the SLA. The average read latency, at the 50th percentile, is typically 4 milliseconds or less.
2929

30-
The write latency for all consistency levels is always guaranteed to be less than 10 milliseconds at the 99th percentile. This write latency is backed by the SLA. The average write latency, at the 50th percentile, is usually 5 milliseconds or less.
30+
The write latency for all consistency levels is always guaranteed to be less than 10 milliseconds at the 99th percentile. This write latency is backed by the SLA. The average write latency, at the 50th percentile, is usually 5 milliseconds or less. Azure Cosmos accounts that span several regions and are configured with strong consistency are an exception to this guarantee.
3131

32-
For Azure Cosmos accounts configured with strong consistency with more than one region, the write latency is guaranteed to be less than two times round-trip time (RTT) between any of the two farthest regions, plus 10 milliseconds at the 99th percentile.
32+
### Write latency and Strong consistency
3333

34-
The exact RTT latency is a function of speed-of-light distance and the Azure networking topology. Azure networking doesn't provide any latency SLAs for the RTT between any two Azure regions. For your Azure Cosmos account, replication latencies are displayed in the Azure portal. You can use the Azure portal (go to the Metrics blade) to monitor the replication latencies between various regions that are associated with your Azure Cosmos account.
34+
For Azure Cosmos accounts configured with strong consistency with more than one region, the write latency is equal to two times round-trip time (RTT) between any of the two farthest regions, plus 10 milliseconds at the 99th percentile. High network RTT between the regions will translate to higher latency for Cosmos DB requests since strong consistency completes an operation only after ensuring that it has been committed to all regions within an account.
35+
36+
The exact RTT latency is a function of speed-of-light distance and the Azure networking topology. Azure networking doesn't provide any latency SLAs for the RTT between any two Azure regions. For your Azure Cosmos account, replication latencies are displayed in the Azure portal. You can use the Azure portal (go to the Metrics blade, select Consistency tab) to monitor the replication latencies between various regions that are associated with your Azure Cosmos account.
37+
38+
> [!IMPORTANT]
39+
> Strong consistency for accounts with regions spanning more than 5000 miles (8000 kilometers) is blocked by default due to high write latency. To enable this capability please contact support.
3540
3641
## Consistency levels and throughput
3742

38-
- For the same number of request units, the session, consistent prefix, and eventual consistency levels provide about two times the read throughput when compared with strong and bounded staleness.
43+
- For strong and bounded staleness, reads are done against two replicas in a four replica set (minority quorum) to provide consistency guarantees. Session, consistent prefix and eventual do single replica reads. The result is that, for the same number of request units, read throughput for strong and bounded staleness is half of the other consistency levels.
3944

4045
- For a given type of write operation, such as insert, replace, upsert, and delete, the write throughput for request units is identical for all consistency levels.
4146

47+
|**Consistency Level**|**Quorum Reads**|**Quorum Writes**|
48+
|--|--|--|
49+
|**Strong**|Local Minority|Global Majority|
50+
|**Bounded Staleness**|Local Minority|Local Majority|
51+
|**Session**|Single Replica (using session token)|Local Majority|
52+
|**Consistent Prefix**|Single Replica|Local Majority|
53+
|**Eventual**|Single Replica|Local Majority|
54+
4255
## <a id="rto"></a>Consistency levels and data durability
4356

4457
Within a globally distributed database environment there is a direct relationship between the consistency level and data durability in the presence of a region-wide outage. As you develop your business continuity plan, you need to understand the maximum acceptable time before the application fully recovers after a disruptive event. The time required for an application to fully recover is known as **recovery time objective** (**RTO**). You also need to understand the maximum period of recent data updates the application can tolerate losing when recovering after a disruptive event. The time period of updates that you might afford to lose is known as **recovery point objective** (**RPO**).
4558

46-
The table below defines the relationship between consistency model and data durability in the presence of region wide outage. It is important to note that in a distributed system, even with strong consistency, it is impossible to have a distributed database with an RPO and RTO of zero due to the CAP Theorem. To learn more about why, see [Consistency levels in Azure Cosmos DB](consistency-levels.md).
59+
The table below defines the relationship between consistency model and data durability in the presence of a region wide outage. It is important to note that in a distributed system, even with strong consistency, it is impossible to have a distributed database with an RPO and RTO of zero due to the CAP Theorem. To learn more about why, see [Consistency levels in Azure Cosmos DB](consistency-levels.md).
4760

4861
|**Region(s)**|**Replication mode**|**Consistency level**|**RPO**|**RTO**|
4962
|---------|---------|---------|---------|---------|

0 commit comments

Comments
 (0)