FailedUnitTest
FailedUnitTest

Reputation: 1800

Partitions vs RUs

Scenario: We have around 800,000 Users using our system. We need to store 5-6KB reports every 2 weeks for each user. There are only a handful of users (50-100) using the system at any one time which may access the reports. I have decided that 'partitioning' by UserId made sense, because the data would be very evenly spread and queries will always be made on 1 partition at a time.

Question: My confusion is, let's say we allocate 5,000RUs of throughput to this collection. Are those RUs elastic across all partitions? Or is it fixed to 5,000RUs/800,000 partitions = 0.00625 RUs/partition at all times?

Upvotes: 3

Views: 198

Answers (2)

David Makogon
David Makogon

Reputation: 71119

As @nick mentioned, RUs are allocated across physical partitions, not logical partitions. You may have one or more logical partitions within the same physical partition, but each underlying physical partition tops out at 10GB and 10,000 RUs.

If you've allocated 5,000 RUs, those RUs are evenly distributed across the physical partitions allocated. If you create a collection with 5,000 RU as the initial allocation, you might find that you have 5 physical partitions, each with 1,000 RU. You can check this within the metrics blade of your database (look at throughput, for a single collection).

The number of physical partitions will be reshuffled, or increased in number, when a physical partition is reaching its 10GB limit, or when RU is reaching the 10,000 RU capacity. Logical partitions are then split across different (or new) physical partitions. And if the physical partition count increases, without increasing RU, the RU per partition will be reduced a bit (e.g. if you went from 5 to 10 physical partitions, your 5,000 RU would now be split 10 ways instead of 5, meaning 500 RU / partition instead of 1,000).

Upvotes: 4

Nick Chapsas
Nick Chapsas

Reputation: 7200

It is evenly shared among each physical partition. What you are thinking is logical partitions, which wouldn't make sense. It is not quite clear in the documentation but you can find hints like this one here.

Also this older post explains: "The provisioned throughput of a collection is distributed evenly among the partitions within a collection."

Even though this post is old (2 years), I cannot find anything else stating otherwise. Testing it would also give you those same results.

Upvotes: 3

Related Questions