Question

Difficulty: EasySet Consistency Levels for Azure Cosmos DB

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?

  1. A
    Strong
  2. SessionAnswer
  3. C
    Eventual
  4. D
    Bounded 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

1
Analyze the requirements for read freshness and consistency scope.
The application requires that users must see their own updates immediately (read-your-own-writes), but other users can tolerate a propagation delay.
This establishes the minimum consistency boundary needed for the user's active session without requiring global strong consistency.
2
Evaluate the cost and latency characteristics of the available Cosmos DB consistency levels.
Strong and Bounded Staleness provide global consistency guarantees but incur higher costs and latencies. Eventual and Consistent Prefix have low latency and cost but do not guarantee read-your-own-writes.
This helps identify the most cost-effective option that satisfies the requirements.
3
Select the default consistency level that matches these exact requirements.
Session consistency provides the required session-bound read-your-own-writes guarantee with low latency and standard read/write costs.
Selecting Session consistency achieves the desired balance of session-scoped data freshness, performance, and resource efficiency.

Key Concept

Azure Cosmos DB consistency levels and their performance/cost trade-offs, specifically Session consistency.
Rate this question