A web application uses a single-region Azure Cosmos DB account with a single write region. The application requires that a user must always see their own updates immediately within their active browser session. Other users can tolerate a slight propagation delay to see these updates. Which consistency level should you configure to meet these requirements with the lowest latency and resource cost?
- AStrong
- SessionAnswer
- CEventual
- DBounded Staleness
Answer
Session consistency should be selected because it provides read-your-own-writes guarantees within the client session at the lowest cost and latency.
Session consistency provides a read-your-own-writes guarantee scoped to the client session. This satisfies the requirement that a user immediately sees their own updates while allowing other users to tolerate a slight delay, all at a lower latency and cost than Strong or Bounded Staleness.
Step-by-Step Solution
Key Concept
Azure Cosmos DB consistency levels and their performance/cost trade-offs, specifically Session consistency.