Search code examples
azureazure-cosmosdbeventual-consistency

Cosmos DB eventual consistency maximum upper bound


We're thinking about using Cosmos DB but can't find any information on what the maximum upper bound would be for eventual consistency, if any.

Can someone provide insight on this please?


Solution

  • There's no upper bound. This is by design, to let you be highly available even in the event of a failure.

    Let's say you have an account with West US as the primary, and East US were the secondary region. In normal operation, they will be up to date with each other (aside from ~60ms lag for replication/speed of light). In this scenario, there's no practical difference between Strong and Eventual consistency.

    Let's look at a failure scenario. What if East US were to be down, say due to a natural disaster, or because the connectivity between West US and East US was severed. What would the Azure Cosmos DB database's behavior be?

    1. With Strong consistency, West US would stop taking writes to ensure that West US and East US don't drift apart.
    2. With Bound Staleness, you can configure a bounded staleness window, say 5 minutes. West US would continue to accept writes for 5 minutes, and East US may be stale by up to 5 minutes. Beyond 5 minutes, West US writes will be unavailable until connectivity to East US is restored. Then East US would catch up and writes can resume.
    3. With Eventual, West US would never stop taking writes. If East US was not down, but simply disconnected (network partition), it would serve stale reads. Again once the region is back up, East US would catch up and writes can resume.

    Again, this is only in the event of failures, not for normal operation where regions are up to date with each other, save for the replication/speed of light latency.

    For further discussion, please email the team at [email protected]