Skip to content

Commit a4a7d1c

Browse files
committed
Adding Gifs for consistency levels
1 parent 6405245 commit a4a7d1c

File tree

6 files changed

+4
-19
lines changed

6 files changed

+4
-19
lines changed

articles/cosmos-db/consistency-levels.md

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ The semantics of the five consistency levels are described here:
3535

3636
- **Strong**: Strong consistency offers a linearizability guarantee. Linearizability refers to serving requests concurrently. The reads are guaranteed to return the most recent committed version of an item. A client never sees an uncommitted or partial write. Users are always guaranteed to read the latest committed write.
3737

38+
The following graphic illustrates the strong consistency with musical notes. After the data is written to the “East US” region, when you read the data from other regions, you get the most recent value:
39+
40+
![video](media/consistency-levels/strong-consistency.gif)
41+
3842
- **Bounded staleness**: The reads are guaranteed to honor the consistent-prefix guarantee. The reads might lag behind writes by at most *"K"* versions (i.e., "updates") of an item or by *"T"* time interval. In other words, when you choose bounded staleness, the "staleness" can be configured in two ways:
3943

4044
* The number of versions (*K*) of the item
@@ -48,25 +52,6 @@ The semantics of the five consistency levels are described here:
4852

4953
- **Eventual**: There's no ordering guarantee for reads. In the absence of any further writes, the replicas eventually converge.
5054

51-
## Consistency levels explained through baseball
52-
53-
Let's take a baseball game scenario as an example. Imagine a sequence of writes that represent the score from a baseball game. The inning-by-inning line score is described in the [Replicated data consistency through baseball](https://www.microsoft.com/en-us/research/wp-content/uploads/2011/10/ConsistencyAndBaseballReport.pdf) paper. This hypothetical baseball game is currently in the middle of the seventh inning. It's the seventh-inning stretch. The visitors are behind with a score of 2 to 5 as shown below:
54-
55-
| | **1** | **2** | **3** | **4** | **5** | **6** | **7** | **8** | **9** | **Runs** |
56-
| - | - | - | - | - | - | - | - | - | - | - |
57-
| **Visitors** | 0 | 0 | 1 | 0 | 1 | 0 | 0 | | | 2 |
58-
| **Home** | 1 | 0 | 1 | 1 | 0 | 2 | | | | 5 |
59-
60-
An Azure Cosmos container holds the run totals for the visitors and home teams. While the game is in progress, different read guarantees might result in clients reading different scores. The following table lists the complete set of scores that might be returned by reading the visitors' and home scores with each of the five consistency guarantees. The visitors' score is listed first. Different possible return values are separated by commas.
61-
62-
| **Consistency level** | **Scores (Visitors, Home)** |
63-
| - | - |
64-
| **Strong** | 2-5 |
65-
| **Bounded staleness** | Scores that are at most one inning out of date: 2-3, 2-4, 2-5 |
66-
| **Session** | <ul><li>For the writer: 2-5</li><li> For anyone other than the writer: 0-0, 0-1, 0-2, 0-3, 0-4, 0-5, 1-0, 1-1, 1-2, 1-3, 1-4, 1-5, 2-0, 2-1, 2-2, 2-3, 2-4, 2-5</li><li>After reading 1-3: 1-3, 1-4, 1-5, 2-3, 2-4, 2-5</li> |
67-
| **Consistent prefix** | 0-0, 0-1, 1-1, 1-2, 1-3, 2-3, 2-4, 2-5 |
68-
| **Eventual** | 0-0, 0-1, 0-2, 0-3, 0-4, 0-5, 1-0, 1-1, 1-2, 1-3, 1-4, 1-5, 2-0, 2-1, 2-2, 2-3, 2-4, 2-5 |
69-
7055
## Additional reading
7156

7257
To learn more about consistency concepts, read the following articles:
76.5 KB
Loading
74.5 KB
Loading
60.3 KB
Loading
76 KB
Loading
71.6 KB
Loading

0 commit comments

Comments
 (0)