|
1 | 1 | ---
|
2 | 2 | title: Manage consistency in Azure Cosmos DB
|
3 |
| -description: Learn how to configure and manage consistency levels in Azure Cosmos DB using Azure portal, .NET SDK, Java SDK and various other SDKs |
| 3 | +description: Learn how to configure and manage consistency levels in Azure Cosmos DB using Azure portal, .NET SDK, Java SDK, and various other SDKs |
4 | 4 | author: seesharprun
|
5 | 5 | ms.service: cosmos-db
|
6 | 6 | ms.subservice: nosql
|
@@ -62,7 +62,7 @@ Update-AzCosmosDBAccount -ResourceGroupName $resourceGroupName `
|
62 | 62 |
|
63 | 63 | ## Override the default consistency level
|
64 | 64 |
|
65 |
| -Clients can override the default consistency level that is set by the service. Consistency level can be set on a per request, which overrides the default consistency level set at the account level. |
| 65 | +Clients can override the default consistency level that is set by the service. The consistency level can be set on a per-request basis, which overrides the default consistency level set at the account level. |
66 | 66 |
|
67 | 67 | > [!TIP]
|
68 | 68 | > Consistency can only be **relaxed** at the SDK instance or request level. To move from weaker to stronger consistency, update the default consistency for the Azure Cosmos DB account.
|
@@ -169,9 +169,9 @@ client = cosmos_client.CosmosClient(self.account_endpoint, {
|
169 | 169 |
|
170 | 170 | One of the consistency levels in Azure Cosmos DB is *Session* consistency. This is the default level applied to Azure Cosmos DB accounts by default. When working with Session consistency, each new write request to Azure Cosmos DB is assigned a new SessionToken. The CosmosClient will use this token internally with each read/query request to ensure that the set consistency level is maintained.
|
171 | 171 |
|
172 |
| -In some scenarios you need to manage this Session yourself. Consider a web application with multiple nodes, each node will have its own instance of CosmosClient. If you wanted these nodes to participate in the same session (to be able read your own writes consistently across web tiers) you would have to send the SessionToken from FeedResponse\<T\> of the write action to the end-user using a cookie or some other mechanism, and have that token flow back to the web tier and ultimately the CosmosClient for subsequent reads. If you are using a round-robin load balancer which does not maintain session affinity between requests, such as the Azure Load Balancer, the read could potentially land on a different node to the write request, where the session was created. |
| 172 | +In some scenarios, you need to manage this Session yourself. Consider a web application with multiple nodes, each node will have its own instance of CosmosClient. If you wanted these nodes to participate in the same session (to be able to read your own writes consistently across web tiers) you would have to send the SessionToken from FeedResponse\<T\> of the write action to the end-user using a cookie or some other mechanism, and have that token flow back to the web tier and ultimately the CosmosClient for subsequent reads. If you are using a round-robin load balancer that does not maintain session affinity between requests, such as the Azure Load Balancer, the read could potentially land on a different node to the write request, where the session was created. |
173 | 173 |
|
174 |
| -If you do not flow the Azure Cosmos DB SessionToken across as described above you could end up with inconsistent read results for a period of time. |
| 174 | +If you do not flow the Azure Cosmos DB SessionToken across as described above, you could end up with inconsistent read results for a while. |
175 | 175 |
|
176 | 176 | Session Tokens in Azure Cosmos DB are partition-bound, meaning they are exclusively associated with one partition. In order to ensure you can read your writes, use the session token that was last generated for the relevant item(s). To manage session tokens manually, get the session token from the response and set them per request. If you don't need to manage session tokens manually, you don't need to use these samples. The SDK keeps track of session tokens automatically. If you don't set the session token manually, by default, the SDK uses the most recent session token.
|
177 | 177 |
|
@@ -288,7 +288,7 @@ item = client.ReadItem(doc_link, options)
|
288 | 288 |
|
289 | 289 | ## Monitor Probabilistically Bounded Staleness (PBS) metric
|
290 | 290 |
|
291 |
| -How eventual is eventual consistency? For the average case, can we offer staleness bounds with respect to version history and time. The [**Probabilistically Bounded Staleness (PBS)**](http://pbs.cs.berkeley.edu/) metric tries to quantify the probability of staleness and shows it as a metric. |
| 291 | +How eventual is eventual consistency? For the average case, we can offer staleness bounds with respect to version history and time. The [**Probabilistically Bounded Staleness (PBS)**](http://pbs.cs.berkeley.edu/) metric tries to quantify the probability of staleness and shows it as a metric. |
292 | 292 |
|
293 | 293 | To view the PBS metric, go to your Azure Cosmos DB account in the Azure portal. Open the **Metrics (Classic)** pane, and select the **Consistency** tab. Look at the graph named **Probability of strongly consistent reads based on your workload (see PBS)**.
|
294 | 294 |
|
|
0 commit comments