Question

Difficulty: Very hardSet Consistency Levels for Azure Cosmos DB

An enterprise application uses an Azure Cosmos DB account distributed across three write regions (East US, West US, and North Europe) with multi-region writes enabled. You need to configure the consistency settings to meet the following requirements:

1. For user profile updates, the application must guarantee that a user always reads their own updates. The web application uses a load balancer, and subsequent requests from the same user may be routed to different web server instances, which must share the session state using the Azure Cosmos DB session token.
2. For a public news feed, the application must minimize read latency and Request Unit (RU) costs while ensuring that readers never see updates out of order.

Which two consistency levels should you select to meet these requirements? (Select two.)

  1. A
    Strong
  2. B
    Bounded Staleness
  3. SessionAnswer
  4. Consistent PrefixAnswer
  5. E
    Eventual

Answer

The correct consistency levels are session consistency and consistent prefix consistency.
The correct consistency levels are session consistency and consistent prefix consistency. Session consistency satisfies the profile update requirement because sharing the session token across web servers guarantees that subsequent read operations can see writes from the same session. Consistent prefix satisfies the news feed requirement because it guarantees that reads see writes in chronological order of their commits, and unlike Bounded Staleness, it costs only one Request Unit per read operation.

Step-by-Step Solution

1
Evaluate consistency level compatibility with the multi-region write configuration.
Strong consistency is ruled out immediately because Azure Cosmos DB does not support Strong consistency on accounts configured with multiple write regions.
Strong consistency requires synchronous replication, which cannot be guaranteed across multiple write regions without introducing severe latency penalties.
2
Identify the consistency level that satisfies the user profile updates requirement.
Session consistency is selected. It provides read-your-own-writes guarantees for a client session, which is preserved across multiple web server instances behind a load balancer by explicitly sharing the session token.
If the session token is not passed, session consistency is scoped only to the individual client instance connection, behaving like eventual consistency across different web servers.
3
Identify the consistency level that satisfies the public news feed requirement.
Consistent Prefix consistency is selected because it guarantees that reads see writes in chronological order of their commits, and it costs only 1 Request Unit (RU) per read.
Eventual consistency does not guarantee order, and Bounded Staleness reads cost 2 RUs, which fails to minimize throughput costs.

Key Concept

Azure Cosmos DB Consistency Levels, multi-region write limitations, and Request Unit (RU) costs.
Rate this question