Bounded Staleness Consistency

Karl Gardner 185 Reputation points
2024-07-13T19:37:44.8133333+00:00

Hello, I have a question with the bounded staleness consistency in cosmos db:

https://learn.microsoft.com/en-us/azure/cosmos-db/consistency-levels#bounded-staleness-consistency

I'm trying to understand the following line: "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." Does this mean that when the staleness for reads in a particular region and partition reach the certain threshold then all writes for that partition (regardless of the region) will be cut off? My interpretation of this is that the lag of the data can technically go over the time limit and thus not bounded it's just that the writes will be cut off at that point. I guess it would never exceed the maximum versions K (number of writes that it is behind) but it could technically reach over the maximum time that the read is behind.

Thanks!

Karl

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,643 questions
0 comments No comments
{count} votes

Accepted answer
  1. Vinodh247 21,961 Reputation points
    2024-07-14T02:10:24.4466667+00:00

    Hi Karl Gardner,

    Thanks for reaching out to Microsoft Q&A.

    For me, your understanding is correct. Putting in more details so other readers can benefit.

    Bounded Staleness Consistency:

    In bounded staleness consistency, the lag of data between any two regions is always less than a specified amount. This amount can be defined in two ways:

    1. K versions (updates): The maximum number of versions (updates) an item may be behind.
    2. T time interval: The maximum time interval reads might lag behind the writes.

    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.

    This means....

    • The staleness for reads in a particular region and partition can technically reach or exceed the configured time limit (T).
    • However, once this happens, any new writes to that partition will be throttled (slowed down or rejected) until the staleness goes back within the configured upper bound.
    • The number of versions (K) that the reads can lag behind will also be bounded by the configured value, even if the time limit (T) is exceeded.

    Your interpretation is correct! The data lag can technically exceed the time limit, but the system will throttle writes to bring it back within the specified bounds. The versions K will not be exceeded, but there might be brief periods where the time T is exceeded during the write throttling process. This mechanism ensures that the bounded staleness consistency level provides a predictable and manageable consistency model, balancing performance and data freshness across distributed regions and partitions in Cosmos DB.

    https://learn.microsoft.com/en-us/answers/questions/116045/azure-cosmosdb-consistency-understanding-bounded-s

    Please 'Upvote'(Thumbs-up) and 'Accept' as an answer if the reply was helpful. This will benefit other community members who face the same issue.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.