Soru

Zorluk: OrtaSet Consistency Levels for Azure Cosmos DB

You are designing a globally distributed application that utilizes Azure Cosmos DB. You need to select the most appropriate consistency level for three different application scenarios to meet their architectural requirements while optimizing for request units (RUs) and performance. Match each application scenario to its optimal Azure Cosmos DB consistency level.

  • A retail checkout application uses a globally distributed Azure Cosmos DB account configured with a single-write region and multiple read regions. To prevent stock discrepancies, client applications must be guaranteed to read the most recent, fully committed write from any region, regardless of latency overhead.Strong consistency
  • An e-commerce user profile application runs on a globally distributed Azure Cosmos DB account with multiple read regions. A web application must guarantee that a user who edits their shipping address will always see the updated address on subsequent page loads within their browser session. Other users do not need to see the update immediately.Session consistency
  • A global package tracking application uses an Azure Cosmos DB account with multiple write regions. The tracking system logs package scan events sequentially (e.g., 'Departed facility' must never be visible before 'Arrived at facility'). The application must guarantee that reads see updates in their exact write order, while keeping Request Unit (RU) costs lower than Bounded Staleness.Consistent Prefix consistency

Cevap

The retail checkout application scenario matches Strong consistency, the e-commerce user profile application matches Session consistency, and the global package tracking application matches Consistent Prefix consistency.
The correct pairings align each scenario with the lowest-overhead consistency level that satisfies its core requirements. The checkout system requires Strong consistency to prevent stock discrepancies. The user profile updates are scoped to a browser session, making Session consistency the ideal choice for read-your-own-writes. The tracking system requires ordered updates without real-time consistency, which is satisfied by Consistent Prefix at a lower cost than Bounded Staleness.

Adım Adım Çözüm

1
Analyze the requirements for the retail checkout application.
The application requires absolute global consistency to prevent stock discrepancies, meaning reads must always return the most recent write. This requires Strong consistency.
Strong consistency is the only level that guarantees reads always return the latest committed write globally.
2
Analyze the requirements for the user profile application.
The user must immediately see their own shipping address updates on subsequent page loads, which is a classic read-your-own-writes requirement scoped to a browser session. This matches Session consistency.
Session consistency is scoped to the client session and guarantees read-your-own-writes, monotonic reads, and monotonic writes.
3
Analyze the requirements for the package tracking application.
The package tracking events must be read in the exact order they were written to avoid logical inconsistencies (e.g., departed before arrived), but real-time global synchronization is not needed. The cost must be lower than Bounded Staleness, which points to Consistent Prefix.
Consistent Prefix guarantees that reads see updates as a prefix of all writes in order, with lower resource overhead than Bounded Staleness.

Anahtar Kavram

Understanding and selecting Azure Cosmos DB consistency levels based on application requirements, latency, ordering guarantees, and resource cost.
Bu soruyu puanla