How are physical partitions created in Cosmos DB when you don't have data?

José Luis Garcia Anticona 26 Reputation points

Hello community, I have an existential question about how physical partitions are created in a container. On my team, we created a container, we raised it to 300,000 RU/s to perform the batch load, but I saw that it had more than 30 partitions. , in the size metric per partition there are more than 30.

Wasn't Cosmos DB supposed to divide the number of allocated RU/s by 10,000 in order to create the necessary physical partitions with that number of RU/s? or how does Cosmos DB actually create the partitions? Thanks in advance for the answers, Regards

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

2 answers

Sort by: Most helpful
  1. Oury Ba-MSFT 16,731 Reputation points Microsoft Employee

    @José Luis Garcia Anticona Thank you for reaching out and sorry for delay in response to your ask.

    According to the following MS documentation

    The number of physical partitions in your container depends on the following characteristics:

    The amount of throughput provisioned (each individual physical partition can provide a throughput of up to 10,000 request units per second). The 10,000 RU/s limit for physical partitions implies that logical partitions also have a 10,000 RU/s limit, as each logical partition is only mapped to one physical partition.

    The total data storage (each individual physical partition can store up to 50 GBs of data).

    Physical partitions are an internal implementation of the system, and they are entirely managed by Azure Cosmos DB. When developing your solutions, don't focus on physical partitions because you can't control them. Instead, focus on your partition keys. If you choose a partition key that evenly distributes throughput consumption across logical partitions, you will ensure that throughput consumption across physical partitions is balanced.

    There's no limit to the total number of physical partitions in your container. As your provisioned throughput or data size grows, Azure Cosmos DB automatically creates new physical partitions by splitting existing ones. Physical partition splits don't affect your application's availability. After the physical partition split, all data within a single logical partition will still be stored on the same physical partition. A physical partition split simply creates a new mapping of logical partitions to physical partitions.



    0 comments No comments

  2. José Luis Garcia Anticona 26 Reputation points

    Hello Oury Ba-MSFT, thank you for responding, it is true what you say about concentrating on the choice of the logical partition, however it is a little frustrating how transparent the management of physical partitions is, since for example, I understand that partitions Physical partitions are not eliminated but rather divided, so if raising the RU/s of a container to 400,000 creates more than 40 physical partitions, when I lower the RU/s again because I finish my load, I will have some RU/s. Let's suppose 4000, which is the minimum that would be allowed, divided by let's say 50, which gives 80 RU/s per partition, but if I only had 40, I would have about 100 RU/s per partition, which gives me more RU/s bag. s to be able to use on each partition. That's what I don't understand, that if they say that the maximum is 10000 RU/s per physical partition, not necessarily then Cosmos db does the division of assigned RU/s / 10000 in order to calculate the number of partitions to create the first time

    0 comments No comments