πŸ”’ Guided

Pre-launch preview. Authorised access only.

Incorrect code

Guided by A Guide to Cloud
Explore AB-900 AI-901 aws-aif-c01
Guided DP-420 Domain 2
Domain 2 β€” Module 3 of 3 100%
14 of 28 overall

DP-420 Study Guide

Domain 1: Design and Implement Data Models

  • Cosmos DB β€” The Big Picture Free
  • Designing Your Data Model Free
  • Partition Key Strategy Free
  • Synthetic and Hierarchical Partition Keys Free
  • Relationships β€” Embedding vs Referencing Free
  • SDK Connectivity and Client Configuration Free
  • SDK CRUD Operations and Transactions Free
  • SQL Queries in Cosmos DB Free
  • SDK Query Pagination and LINQ Free
  • Server-Side Programming Free
  • Transactions in Practice Free

Domain 2: Design and Implement Data Distribution

  • Global Replication and Failover
  • Consistency Levels: Five Choices, Real Trade-Offs
  • Multi-Region Writes and Conflict Resolution

Domain 3: Integrate and Move Data

  • Change Feed with Azure Functions and Processors
  • Analytical Workloads: Synapse Link and Fabric Mirroring
  • Data Movement: ADF, Kafka, and Spark Connectors

Domain 4: Optimize Query and Operation Performance

  • Indexing Policies: Range, Spatial, and Composite
  • Request Units and Query Cost Optimization
  • Integrated Cache and Dedicated Gateway
  • Change Feed Patterns: Materialized Views and Estimator

Domain 5: Maintain an Azure Cosmos DB Solution

  • Monitoring: Metrics, Logs, and Alerts
  • Backup and Restore: Periodic vs Continuous
  • Network Security: Firewalls, VNets, and Private Endpoints
  • Data Security: Encryption, Keys, and RBAC
  • Cost Optimization: Throughput Modes and RU Strategy
  • DevOps: Infrastructure as Code and Deployments
  • Exam Strategy and Cross-Domain Review

DP-420 Study Guide

Domain 1: Design and Implement Data Models

  • Cosmos DB β€” The Big Picture Free
  • Designing Your Data Model Free
  • Partition Key Strategy Free
  • Synthetic and Hierarchical Partition Keys Free
  • Relationships β€” Embedding vs Referencing Free
  • SDK Connectivity and Client Configuration Free
  • SDK CRUD Operations and Transactions Free
  • SQL Queries in Cosmos DB Free
  • SDK Query Pagination and LINQ Free
  • Server-Side Programming Free
  • Transactions in Practice Free

Domain 2: Design and Implement Data Distribution

  • Global Replication and Failover
  • Consistency Levels: Five Choices, Real Trade-Offs
  • Multi-Region Writes and Conflict Resolution

Domain 3: Integrate and Move Data

  • Change Feed with Azure Functions and Processors
  • Analytical Workloads: Synapse Link and Fabric Mirroring
  • Data Movement: ADF, Kafka, and Spark Connectors

Domain 4: Optimize Query and Operation Performance

  • Indexing Policies: Range, Spatial, and Composite
  • Request Units and Query Cost Optimization
  • Integrated Cache and Dedicated Gateway
  • Change Feed Patterns: Materialized Views and Estimator

Domain 5: Maintain an Azure Cosmos DB Solution

  • Monitoring: Metrics, Logs, and Alerts
  • Backup and Restore: Periodic vs Continuous
  • Network Security: Firewalls, VNets, and Private Endpoints
  • Data Security: Encryption, Keys, and RBAC
  • Cost Optimization: Throughput Modes and RU Strategy
  • DevOps: Infrastructure as Code and Deployments
  • Exam Strategy and Cross-Domain Review
Domain 2: Design and Implement Data Distribution Premium ⏱ ~14 min read

Multi-Region Writes and Conflict Resolution

Understand when to enable multi-region writes, how Last-Writer-Wins and custom conflict resolution work, and the impact on consistency levels and application design.

When writes need to be everywhere

β˜• Simple explanation

Imagine GlobeCart has checkout counters in 12 countries. With single-write, every sale must phone home to the one β€œmaster” counter in East US. That’s slow and fragile β€” if East US goes down, nobody can buy anything.

Multi-region writes let each country process sales locally. Faster checkouts, higher availability. The catch? Two countries might sell the last item simultaneously β€” you need a rule to break the tie.

Multi-region writes (also called multi-master) allow all configured regions to accept write operations. Benefits:

  • Write latency: Writes go to the nearest region β€” single-digit ms globally.
  • Write availability: SLA jumps to 99.999% (five nines).
  • No single point of failure: No single write region to lose.

The trade-off is conflict resolution β€” concurrent writes to the same item in different regions must be reconciled.

Jake’s decision: single-write or multi-write?

πŸ›’ Jake at GlobeCart runs in 12 regions. His product catalogue is read-heavy (99% reads), so single-write works fine β€” read replicas handle the load. But the order processing system is write-heavy: customers place orders from everywhere simultaneously.

Jake enables multi-region writes for the orders database to get:

  • Local write latency for checkout speed
  • 99.999% availability SLA
  • No write outage during regional failures

Single-write vs multi-write

AspectSingle-WriteMulti-Write
Write locationOne designated regionAny configured region
Write latencyLow locally, high remotelyLow everywhere
Availability SLA99.99%99.999%
Consistency levelsAll 5 availableSession, Consistent Prefix, Eventual only
Conflict resolutionNot neededRequired (LWW default)
CostStandard per-region RUHigher β€” write RU in every region
Failover behaviourPromote read region to writeNo failover needed β€” all regions write
Best forRead-heavy, simple architectureWrite-heavy, global low-latency writes

Conflict resolution: Last-Writer-Wins (LWW)

LWW is the default conflict resolution policy. When two regions write to the same item simultaneously, the write with the highest value on the conflict resolution path wins.

Default conflict resolution path: _ts (timestamp)

Region A writes product price = $29.99 at _ts = 1000
Region B writes product price = $24.99 at _ts = 1001

Winner: Region B ($24.99) β€” higher _ts wins
Loser:  Region A's write is discarded silently

Custom LWW path

You can use any numeric property instead of _ts:

// Use a custom numeric property for LWW
ContainerProperties properties = new ContainerProperties("orders", "/customerId")
{
    ConflictResolutionPolicy = new ConflictResolutionPolicy
    {
        Mode = ConflictResolutionMode.LastWriterWins,
        ResolutionPath = "/priority"  // higher numeric value wins
    }
};
πŸ’‘ Exam tip: LWW path must be numeric

The LWW conflict resolution path must point to a numeric property. If you specify a path that doesn’t exist or isn’t numeric, Cosmos DB falls back to _ts. The exam may test this edge case β€” an invalid path doesn’t throw an error; it silently uses _ts.

Custom conflict resolution (stored procedure)

For complex merge logic, register a stored procedure that runs when conflicts are detected:

ContainerProperties properties = new ContainerProperties("inventory", "/warehouseId")
{
    ConflictResolutionPolicy = new ConflictResolutionPolicy
    {
        Mode = ConflictResolutionMode.Custom,
        ResolutionProcedure = "dbs/globecart/colls/inventory/sprocs/mergeInventory"
    }
};

The stored procedure receives both conflicting documents and must return the merged result. If the procedure fails or isn’t registered, conflicts go to the conflict feed for manual resolution.

The conflict feed

When conflicts can’t be auto-resolved (custom mode without a procedure, or procedure failure), they land in the conflict feed β€” a system container you can read programmatically:

FeedIterator<ConflictProperties> conflicts = container.Conflicts
    .GetConflictQueryIterator<ConflictProperties>();

while (conflicts.HasMoreResults)
{
    FeedResponse<ConflictProperties> response = await conflicts.ReadNextAsync();
    foreach (ConflictProperties conflict in response)
    {
        Console.WriteLine($"Conflict on {conflict.Id}, type: {conflict.OperationType}");
    }
}
πŸ’‘ Exam tip: conflict feed expiration

Conflicts in the conflict feed are retained based on the container’s TTL setting. If you don’t process them, they expire. In LWW mode, the conflict feed is empty because conflicts are auto-resolved β€” only Custom mode uses the feed (when the stored procedure is missing or fails).

Impact on consistency

Enabling multi-region writes restricts your consistency options:

Consistency LevelAvailable?Why
Strong❌Requires single write source for linearizability
Bounded Staleness❌Requires single write source for staleness bounds
Sessionβœ…Read-your-own-writes per session still works
Consistent Prefixβœ…Write ordering within a region is preserved
Eventualβœ…No ordering guarantees needed

Sophie’s tip: πŸ—„οΈ Sophie points out that if Jake’s order system previously relied on Strong consistency for inventory checks, switching to multi-region writes means redesigning that flow to handle Session consistency β€” possibly using optimistic concurrency with ETags instead.

🎬 Video walkthrough

🎬 Video coming soon

Multi-Region Writes and Conflict Resolution β€” DP-420 Module 14

Multi-Region Writes and Conflict Resolution β€” DP-420 Module 14

~14 min

Flashcards

Question

What is the default conflict resolution policy in multi-region writes?

Click or press Enter to reveal answer

Answer

Last-Writer-Wins (LWW) using the _ts (timestamp) property. The write with the highest _ts value wins. You can configure a custom numeric path instead of _ts.

Click to flip back

Question

What happens if the LWW resolution path points to a non-existent or non-numeric property?

Click or press Enter to reveal answer

Answer

Cosmos DB silently falls back to _ts (timestamp) as the conflict resolution path. It does NOT throw an error. This is an exam trap β€” invalid paths don't fail, they default.

Click to flip back

Question

Where do unresolved conflicts go in Custom conflict resolution mode?

Click or press Enter to reveal answer

Answer

To the conflict feed β€” a system container that stores both conflicting versions for manual or programmatic resolution. Conflicts expire based on the container's TTL setting.

Click to flip back

Knowledge Check

Knowledge Check

Jake enables multi-region writes for GlobeCart's order system. Two customers in different regions update the same order simultaneously. The account uses the default conflict resolution policy. Which write wins?

Knowledge Check

Jake wants his inventory system to merge conflicting stock updates rather than picking one winner. What should he configure?

Knowledge Check

After enabling multi-region writes, Jake's team discovers their code relies on Strong consistency for critical reads. What's the impact?


Next up: Change Feed with Azure Functions and Processors β€” how to react to data changes in real time by streaming inserts and updates from your Cosmos DB containers.

← Previous

Consistency Levels: Five Choices, Real Trade-Offs

Next β†’

Change Feed with Azure Functions and Processors

Guided

I learn, I simplify, I share.

A Guide to Cloud YouTube Feedback

© 2026 Sutheesh. All rights reserved.

Guided is an independent study resource and is not affiliated with, endorsed by, or officially connected to Microsoft. Microsoft, Azure, and related trademarks are property of Microsoft Corporation. Always verify information against Microsoft Learn.