seniorCosmos DB

How does Cosmos DB achieve global distribution and consistency trade-offs?

Updated Feb 20, 2026

Short answer

Azure Cosmos DB achieves global distribution through automatic replication across regions and allows developers to choose consistency levels to balance performance and correctness.

Deep explanation

Azure Cosmos DB is designed for multi-region applications. Data is automatically replicated to multiple Azure regions, allowing users to access data from the nearest region, reducing latency.

To manage distributed system trade-offs, Cosmos DB offers five consistency levels:

  • Strong consistency: Guarantees linearizability (most strict, higher latency)
  • Bounded staleness: Reads lag behind writes by a fixed amount
  • Session consistency: Guarantees read-your-writes within a session (default)
  • Consistent prefix: Reads see ordered writes
  • Eventual consistency: Fastest, but temporary inconsistency possible

This design follows the CAP theorem trade-off: Cosmos DB prioritizes availability and partition tolerance while allowing configurable consistency.

Applications can choose consistency based on business needs:

  • Banking → Strong or bounded staleness
  • Social media feeds → Session or eventual consistency

Real-world example

A global messaging app:

  • User in India sends a message
  • User in USA receives it quickly from local replica
  • Session consistency ensures the sender immediately sees their message, while other users may see it slightly later depending on region replication delay

Common mistakes

  • - Always choosing strong consistency without considering latency.
  • - Ignoring consistency impact on performance and cost.
  • - Assuming all regions see data instantly regardless of configuration.

Follow-up questions

  • What is the CAP theorem in distributed systems?
  • When should you use session consistency?

More Cosmos DB interview questions

View all →