Soru

Zorluk: ZorSet Consistency Levels for Azure Cosmos DB

An organization is developing a globally distributed collaborative document editing application. The database is hosted on an Azure Cosmos DB Core (SQL) API account configured with two write regions (East US and West US) and multi-region writes enabled.

A background analytical microservice has independent instances running in both regions to process document updates. These worker instances do not share a client session or session tokens.

The application requirements are as follows:
- The worker instances must always read document updates in the exact order they were written.
- The configuration must minimize write latency and consume the fewest Request Units (RUs).

You need to configure the Cosmos DB account and application.

Which two actions should you perform? (Select two.)

  1. Set the default consistency level of the Cosmos DB account to Consistent Prefix.Cevap
  2. Set the default consistency level of the Cosmos DB account to Session.Cevap
  3. C
    Set the default consistency level of the Cosmos DB account to Strong.
  4. D
    Rely on the default Session consistency to guarantee read-your-own-writes across the independent worker instances without sharing the session token.
  5. E
    Change the document partition key to a low-cardinality property, such as a static status string, to force all updates into a single logical partition for ordering.

Cevap

Configuring the account to use Consistent Prefix or Session consistency guarantees that updates are read in order while minimizing latency and RU cost. Relying on Session consistency without sharing tokens, selecting Strong consistency, or choosing low-cardinality partition keys are incorrect.
Consistent Prefix and Session consistency levels are correct because they both guarantee that reads will see updates in the order they were written (Consistent Prefix guarantee) while offering the lowest write latency and lowest RU cost. For Session consistency, reads outside the session scope automatically fall back to Consistent Prefix behavior. Both levels are fully supported in accounts with multiple write regions.

Adım Adım Çözüm

1
Analyze the database configuration and region write settings.
Identify that the Azure Cosmos DB account has multi-region writes enabled, which immediately rules out Strong consistency.
Strong consistency is not supported for multi-region write accounts.
2
Evaluate the consistency level ordering guarantees for client instances that do not share session tokens.
Determine that the Session and Consistent Prefix levels both guarantee Consistent Prefix (reads never see out-of-order writes) for independent sessions.
When a client reads from Cosmos DB without a session token under Session consistency, it falls back to Consistent Prefix guarantees.
3
Compare the latency and RU costs of the supported ordered consistency levels.
Session and Consistent Prefix provide lower latency and lower RU costs compared to Bounded Staleness.
Bounded Staleness requires replicating updates across regions within a defined window, which increases write latency and RU consumption.

Anahtar Kavram

Azure Cosmos DB Consistency Levels and Multi-Region Writes
Bu soruyu puanla