Question

Difficulty: MediumAzure Cosmos DB and NoSQL Solutions

You are designing a global database solution using Azure Cosmos DB. You need to match the specific application requirements on the left to the appropriate Azure Cosmos DB consistency level on the right that meets those requirements with the lowest latency and highest availability.

  • A financial reporting application requiring that reads never see out-of-order updates, and replication lag must not exceed 55 minutes or 100,000100,000 operations.Bounded Staleness consistency
  • A stock trading platform where all reads across all regions must return the absolute latest, committed write, accepting higher latency and lower availability.Strong consistency
  • A collaborative document editing application where users must always read their own writes immediately, but other users can see updates with a slight delay.Session consistency
  • A blog comments section where comments must appear in the order they were posted, but there is no requirement for real-time synchronization.Consistent Prefix consistency

Answer

The collaborative document editor matches Session consistency. The financial reporting application matches Bounded Staleness consistency. The stock trading platform matches Strong consistency. The blog comments section matches Consistent Prefix consistency.
Each application requirement matches the most cost-effective and performant consistency level that satisfies its specific ordering and latency constraints. Strong consistency is used for absolute real-time correctness; Bounded Staleness for predictable regional lag limits; Session for read-your-own-writes session isolation; and Consistent Prefix for basic sequence preservation without real-time synchronization.

Step-by-Step Solution

1
Analyze the collaborative document editor requirement for reading own writes.
Identify Session consistency as it provides the read-your-own-writes guarantee within a client session at low latency.
Session consistency is the default and optimized level for user-specific write-to-read flows.
2
Analyze the financial reporting application requirement for bound operations and time limits.
Identify Bounded Staleness consistency as it explicitly bounds lag by operations (KK) or time (TT).
This consistency level is designed specifically for applications that can tolerate some staleness but need a strict SLA on how far behind reads can be.
3
Analyze the stock trading platform requirement for absolute latest reads.
Identify Strong consistency as it ensures linearizability across all regions.
Strong consistency guarantees that a read always returns the most recent write, which is critical for financial transactions where stale reads are unacceptable.
4
Analyze the blog comments requirement for ordered but delayed updates.
Identify Consistent Prefix consistency as it guarantees that updates are returned in order without out-of-sequence anomalies.
Consistent Prefix is the lowest latency consistency model that still guarantees sequence preservation, preventing comments from appearing out of order.

Key Concept

Azure Cosmos DB Consistency Levels
Rate this question