Azure CosmosDB - RU distribution

MS Prog 471 Reputation points
2020-10-15T04:21:04.467+00:00

Hello,
Just trying to get my head around Partitioning and RUs.

Here is a scenario. We have a container called SalesZones, allocated with say 400 RUs, with a paritionkey on a attribute called ZoneId.
There are 10 zones so we have 10 logical partitions.

Now the question is how the allocated RUs is distributed amongst the partitions. Is it evenly spread so that each partition can have a max of 40 RUs? or is there some other mechanism?

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

Accepted answer
  1. Anurag Sharma 17,531 Reputation points
    2020-10-15T05:20:04.247+00:00

    Hi @MS Prog ,

    There are 2 ways you can provision throughout, one at container level and one at database level. Lets consider the scenario at container level in your case:

    Provisioned the throughput at the container level: Throughput is distributed among all the physical partitions which in turn will be distributed across all the logical partitions within them. e.g. If we provision a throughput of 18,000 request units per second (RU/s), then each of the three physical partition can utilize 1/3 of the total provisioned throughput. Within the selected physical partition, the logical partition can, collectively, utilize the physical partition's 6,000 provisioned RU/s. So there are chances that one logical partition can consume more RU than other depending on the documents per logical partition.

    You can refer to article for more details.

    Your scenario: 40 RUs per logical partition is possible when the load across all 10 zones have been divided almost uniformly. If load on few zones are higher they will consume more RUs than other zones. These are knows as 'hot partitions'. Hence picking up a partition key that has wide range of values will help in creating balanced partitions.

    Please let us know if that helps or else we can discuss more.

    ----------

    If answer helps, please 'Accept Answer' as it could help other community members having similar issue

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful