With Bounded Staleness, data is replicated to a local majority (three replicas in a four replica set) in the single region. If the data lag in a region (determined per physical partition) exceeds the configured staleness value, writes for that partition are throttled until staleness is back within the configured upper bound.įor a single-region account, Bounded Staleness provides the same write consistency guarantees as Session and Eventual Consistency. The time interval ( T) reads might lag behind the writesīounded Staleness is beneficial primarily to single-region write accounts with two or more regions.The number of versions ( K) of the item.In other words, when you choose bounded staleness, the maximum "staleness" of the data in any region can be configured in two ways: The amount can be "K" versions (that is, "updates") of an item or by "T" time intervals, whichever is reached first. In bounded staleness consistency, the lag of data between any two regions is always less than a specified amount. In both scenarios, while not common, there may occasionally be a replication lag from one region to another. For multi-region write accounts with two or more regions, data is replicated from the region it was originally written in to all other writable regions. After the data is written to the "West US 2" region, when you read the data from other regions, you get the most recent value:įor single-region write accounts with two or more regions, data is replicated from the primary region to all secondary (read-only) regions. The following graphic illustrates the strong consistency with musical notes. Users are always guaranteed to read the latest committed write. A client never sees an uncommitted or partial write. The reads are guaranteed to return the most recent committed version of an item. Linearizability refers to serving requests concurrently. Strong consistency offers a linearizability guarantee. The semantics of the five consistency levels are described in the following sections. The precise definitions of the five consistency levels in Azure Cosmos DB using the TLA+ specification language are provided in the azure-cosmos-tla GitHub repo. Guarantees associated with consistency levelsĪzure Cosmos DB guarantees that 100 percent of read requests meet the consistency guarantee for the consistency level chosen. This ensures the SDK uses the new default consistency level. This can be done by restarting the application. It is required to recreate any SDK instance after changing the default consistency level. You can also override the default consistency level for a specific request, to learn more, see how to Override the default consistency level article. To learn more, see how to configure the default consistency level. All reads and queries issued against a container or a database use the specified consistency level by default. The default consistency level configured on your account applies to all Azure Cosmos DB databases and containers under that account. You can configure the default consistency level on your Azure Cosmos DB account at any time. A remote client or a stored procedure can issue the read operation. Read consistency applies to a single read operation scoped within a logical partition. For details on consistency level mapping between MongoDB and Azure Cosmos DB, see API for MongoDB consistency mapping. For details on consistency level mapping between Apache Cassandra and Azure Cosmos DB, see API for Cassandra consistency mapping. In API for Gremlin or Table, the default consistency level configured on the Azure Cosmos DB account is used. These include MongoDB, Apache Cassandra, Apache Gremlin, and Azure Table Storage. The following image shows the different consistency levels as a spectrum.Ĭonsistency levels and Azure Cosmos DB APIsĪzure Cosmos DB provides native support for wire protocol-compatible APIs for popular databases. From strongest to weakest, the levels are:įor more information on the default consistency level, see configuring the default consistency level or override the default consistency level.Įach level provides availability and performance tradeoffs. Azure Cosmos DB offers five well-defined levels. Most commercially available distributed NoSQL databases available in the market today provide only strong and eventual consistency.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |