0
votes

According to docs, documents with different partitionKey may end up in same partition but documents with same partitionKey are guaranteed to end up in same partition.

Now, lets consider a case where you have partitionKey with cardinality=100 (for example 100 tenants). Initially, all data is roughly equally distributed across partitions.

Lety say you end up with partitions of about 50GB size. I would assume in that case you might have a few partition keys contained within same partition. Then, all of the sudden your 2 tenants grow exponentially and they go to 200GB size.

Since partition have 250GB limit, now you're in problem.

Questions:

  1. How is this being solved?
  2. Is DocumentDB partitioning handling this moving to separate partitions?
  3. Should we (and are we even able to) view data/storage consumption per partitionKey (not partition)?

If someone could shed a bit of light to these dilemas as i couldnt find answers to these specific questions in docs.

1

1 Answers

2
votes

Currently, the logical partition for Single partition key cannot exceed 10GB. It means you have to ensure that at any given point of the time your logical partition does not exceed 10GB.

Source MSDN

A logical partition is a partition within a physical partition that stores all the data associated with a single partition key value. A logical partition has a 10 GB max.

On your question.

How is this being solved?

Choosing the appropriate partition key and ensure it is well balanced. If you anticipate that a tenant data might grow beyond 10GB, then having tenant id as partition key is not an option. You have to have something else as a partition key which can be scalable.

Is DocumentDB partitioning handling this moving to separate partitions?

Yes, CosmosDB will take care of Physical Partition handling.

Should we (and are we even able to) view data/storage consumption per partitionKey (not partition)?

Yes, In the Azure portal, go to Azure Cosmos DB account and click on Metrics in Monitoring section and then on right pane click on storage tab to see how your data is partitioned in different physical partition