Microsoft Azure Data FundamentalsDescribe how to work with non-relational data on AzureHard
A healthcare provider is building an application to manage patient records. These records are complex JSON documents that include nested arrays and varying attributes. The application requires strong consistency for critical medical data and needs to be globally distributed for high availability across multiple regions. Which Azure Cosmos DB consistency level provides the strongest guarantee, ensuring that reads always return the most recent committed version of a record?
- AStrong
- BSession
- CEventual
- DConsistent Prefix
Show answer & explanationAnswer & explanation
Correct answer: A. Strong
Strong consistency in Azure Cosmos DB guarantees that reads always return the most recent committed version of a record. This is crucial for critical medical data where data integrity and immediate consistency across all regions are paramount, ensuring that all replicas are synchronized before a read is acknowledged.
Why the other options are wrong
- B. Session consistency guarantees consistency within a single client session, but not across different sessions or global replicas immediately.
- C. Eventual consistency offers the lowest latency and highest throughput but provides no ordering guarantee for reads, which is unacceptable for critical medical data.
- D. Consistent Prefix provides that reads will not see out-of-order writes, but updates might still lag, not guaranteeing the absolute latest version.
Azure Cosmos DB Strong Consistency
The highest consistency level in Azure Cosmos DB, guaranteeing that reads always return the most recent committed version of a record.
- All replicas are synchronized before a write is acknowledged.
- Provides global linearizability.
- Offers the highest data integrity but comes with higher latency.
- Suitable for scenarios where data correctness is paramount (e.g., financial transactions, medical records).
Memory trick: Consistency is a spectrum from 'Strong' (always up-to-date) to 'Eventual' (eventually up-to-date).