Soru

Zorluk: OrtaSet Consistency Levels for Azure Cosmos DB

A globally distributed web application uses an Azure Cosmos DB API for NoSQL account with Session consistency. The account has a write region in East US and a read region in West US. Users report that when they update their profile on a mobile app and immediately view it on a web browser, the updates are not visible. You need to resolve this issue in the most cost-effective manner while maintaining low latency. Which of the following actions should you perform?

  1. Extract the session token from the write response on the mobile app and pass it to the read request on the web browser client.Cevap
  2. B
    Rely on the default Session consistency configuration without changes, because Session consistency natively guarantees read-your-writes consistency across different client sessions and devices.
  3. C
    Recreate the Cosmos DB container using a new partition key that has lower cardinality to ensure that data replicates faster between regions.
  4. D
    Change the default consistency level of the Azure Cosmos DB account to Strong consistency.

Cevap

Extract the session token from the write response on the mobile app and pass it to the read request on the web browser client.
Extracting the session token from the write response and passing it to the read request allows the session context to be shared across distinct client instances. This satisfies the read-your-writes requirement for different devices while preserving the low latency and low cost of Session consistency.

Adım Adım Çözüm

1
Analyze the consistency requirements and constraints.
The application requires read-your-writes consistency across two different client sessions (mobile app and web browser) in a cost-effective manner without increasing write latency.
By default, Session consistency guarantees read-your-writes only within the same client session.
2
Evaluate how to extend Session consistency across clients.
The Azure Cosmos DB SDK allows extracting the session token from the header of a write operation response and passing it to a different client instance for subsequent reads.
This allows the second client to participate in the same session context, achieving the required consistency without changing the database account's consistency level.

Anahtar Kavram

Session consistency token passing in Azure Cosmos DB
Bu soruyu puanla