exam questions

Exam DP-201 All Questions

View all questions & answers for the DP-201 exam

Exam DP-201 topic 1 question 22 discussion

Actual exam question from Microsoft's DP-201
Question #: 22
Topic #: 1
[All DP-201 Questions]

Your company is an online retailer that can have more than 100 million orders during a 24-hour period, 95 percent of which are placed between 16:30 and 17:00.
All the orders are in US dollars. The current product line contains the following three item categories:
✑ Games with 15,123 items
✑ Books with 35,312 items
✑ Pens with 6,234 items
You are designing an Azure Cosmos DB data solution for a collection named Orders Collection. The following documents is a typical order in Orders Collection.

Orders Collection is expected to have a balanced read/write-intensive workload.
Which partition key provides the most efficient throughput?

  • A. Item/Category
  • B. OrderTime
  • C. Item/Currency
  • D. Item/id
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️
Choose a partition key that has a wide range of values and access patterns that are evenly spread across logical partitions. This helps spread the data and the activity in your container across the set of logical partitions, so that resources for data storage and throughput can be distributed across the logical partitions.
Choose a partition key that spreads the workload evenly across all partitions and evenly over time. Your choice of partition key should balance the need for efficient partition queries and transactions against the goal of distributing items across multiple partitions to achieve scalability.
Candidates for partition keys might include properties that appear frequently as a filter in your queries. Queries can be efficiently routed by including the partition key in the filter predicate.
Reference:
https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview#choose-partitionkey

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
kempstonjoystick
Highly Voted 5 years, 2 months ago
Given there are 100 million orders in a 24 hour period, and there are only three catgegories, is Item/Id not a better solution, otherwise the category will cause significant hotspots?
upvoted 67 times
Taddi10
4 years, 10 months ago
I think if the id was an integrer (inremental foe exemple ) it can be a good partition key but with this format i think category is the best choice
upvoted 7 times
...
...
MamadouNiang
Highly Voted 5 years, 1 month ago
2 paragraphs below the link given in microsoft docs, there is an interesting answer : Using item ID as the partition key If your container has a property that has a wide range of possible values, it is likely a great partition key choice. One possible example of such a property is the item ID. For small read-heavy containers or write-heavy containers of any size, the item ID is naturally a great choice for the partition key. The item ID is a great partition key choice for the following reasons: There are a wide range of possible values (one unique item ID per item). Because there is a unique item ID per item, the item ID does a great job at evenly balancing RU consumption and data storage. You can easily do efficient point reads since you'll always know an item's partition key if you know its item ID.
upvoted 35 times
Treadmill
4 years, 10 months ago
D correct: Source as above quoted https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview
upvoted 2 times
...
...
IAMKPR
Most Recent 4 years ago
Answer should be "item/id". You can find almost similar example in below link. https://docs.microsoft.com/en-us/learn/modules/monitor-and-scale-cosmos-db/5-partition- lesson
upvoted 5 times
MMM777
4 years ago
This example is definitely VERY similar to the question and explains why several of the proposed values are not good choices, and also shows "Item/Id" to be a decent choice.
upvoted 1 times
...
...
davita8
4 years, 1 month ago
D. Item/id is the answer
upvoted 6 times
...
Deepu1987
4 years, 3 months ago
Given solution is right where we choose the item/category. It's explained in detail in the below link https://medium.com/walmartglobaltech/deep-dive-azure-cosmos-partitions-and-partitionkey-14e898f371cd this concept is of major focus as question may not be exactly asked in exam we need to need to know the concept of physical & logical partitions pre-requisites & Partition key as well.
upvoted 1 times
BobFar
4 years ago
the item/id is the correct solution, regarding to the explanation in the link that you posted, all the documents related to the item/id will store in same partition.
upvoted 1 times
...
...
TaherAli2020
4 years, 3 months ago
If you use the Item/Category property as a partition key, then it has a small cardinality. Even if the documents are evenly distributed across the collection, for large collections, any category might outgrow a single partition. If the categories aren't evenly distributed across the documents in the collection, then the problem is even worse. The dominant category restricts the ability of Azure Cosmos DB to scale. Item/Category is not a good choice for the partition key. https://docs.microsoft.com/en-us/learn/modules/monitor-and-scale-cosmos-db/5-partition-lesson
upvoted 14 times
cadio30
4 years ago
perfect! the link provided clear states the strategy of optimizing partition.
upvoted 2 times
...
tejasjoshi
3 years, 11 months ago
Superb ! Its crystal clear now. Partition should be on Item/id. Requesting all to go through above link.
upvoted 2 times
...
sturcu
4 years, 3 months ago
Nice link. It is exactly the case from the ex.
upvoted 1 times
...
TkSQL
4 years, 1 month ago
this link is the answer to all the confusion here
upvoted 3 times
...
...
syu31svc
4 years, 6 months ago
From https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview#choose-partitionkey: "Have a high cardinality. In other words, the property should have a wide range of possible values." D is the answer
upvoted 4 times
...
brcdbrcd
4 years, 6 months ago
item/id for sure. see the section "Propose partition key values for the collection" at: https://docs.microsoft.com/en-us/learn/modules/monitor-and-scale-cosmos-db/5-partition-lesson
upvoted 5 times
...
lingjun
4 years, 6 months ago
Candidates for partition keys might include properties that appear frequently as a filter in your queries. Queries can be efficiently routed by including the partition key in the filter predicate. Item ID will not appear as a filter most likely
upvoted 1 times
lingjun
4 years, 6 months ago
For small read-heavy containers or write-heavy containers of any size, Item-ID is naturally good choice. In this case, we have balanced read/write workload
upvoted 1 times
...
...
M0e
4 years, 7 months ago
Given the discussion here: https://docs.microsoft.com/en-us/learn/modules/monitor-and-scale-cosmos-db/5-partition-lesson, "Item/id" is the correct answer
upvoted 12 times
...
monumentalcrankiness
4 years, 7 months ago
I shall go with D. Item/Id Item/Category is out. It will only create 3 logical partitions, that also unevenly distributed. A logical distribution has a size cap of 20 GB. With 100 million orders per day, it won't be very hard to reach that limit quickly. OrderTime is out. 16:30 to 17:00 spike shall create a hotspot problem. Item/Currency is out. Only 1 value "USD" will result in everything cramming up one logical partition. Only Item/id is left. So this is the answer.
upvoted 8 times
...
Shivam131
4 years, 8 months ago
your partition key should: Be a property that has a value which does not change. If a property is your partition key, you can't update that property's value. Have a high cardinality. In other words, the property should have a wide range of possible values. Spread request unit (RU) consumption and data storage evenly across all logical partitions. This ensures even RU consumption and storage distribution across your physical partitions.
upvoted 1 times
...
Ash666
4 years, 10 months ago
https://docs.microsoft.com/en-us/azure/cosmos-db/partition-data#logical-partitions https://docs.microsoft.com/en-us/azure/cosmos-db/partitioning-overview https://www.examtopics.com/exams/microsoft/dp-201/view/6/ D Item/ID Category doesn’t distribute RU evenly across partitions. Low cardinality.
upvoted 3 times
...
Yaswant
4 years, 10 months ago
Consider we have provisioned a throughput of 1200 request units and we know that throughput can be provisioned in cosmos db only at a container level or at a database level. In our case we consider our online retailer to be Walkart. Now walkart has an account in cosmosdb and they have a document db with coresql api. Now walkart has created a container named orders in their cosmos account and provisioned 1200ru's. Now consider the case of choosing a partition key. Considering they have 1200 customer id-s and if they use id as partition key they will have their throughput spread across partitions which makes their unused throughput in vain as customers come buy and go and it makes a hotspot. Now if we choose product category as partition we'll be having a balanced throughput and read-write.
upvoted 1 times
...
krisspark
4 years, 10 months ago
these comments causing further confusing for new bees as it's not able to draw whats final correct answer.. I would go by Item/Category only... this combo may not give repeated values as item would be different in same category.. item/id might create super heavy number of partitions
upvoted 1 times
...
LeonLeon
4 years, 11 months ago
In this case A is correct indeed. See the reference and be aware of the read/write balancing. The read is as important as the throuput. Partition keys for read-heavy containers For most containers, the above criteria is all you need to consider when picking a partition key. For large read-heavy containers, however, you might want to choose a partition key that appears frequently as a filter in your queries. Queries can be efficiently routed to only the relevant physical partitions by including the partition key in the filter predicate. If most of your workload's requests are queries and most of your queries have an equality filter on the same property, this property can be a good partition key choice. For example, if you frequently run a query that filters on UserID, then selecting UserID as the partition key would reduce the number of cross-partition queries
upvoted 7 times
Sudipta3009
4 years, 10 months ago
Ur explanation is correct
upvoted 1 times
...
...
BHAWS
4 years, 12 months ago
Choose a partition key that has a wide range of values,so the data is evenly spread across logical partitioning. Hence I suggest the answer is item/category
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...