DP-420 · Question #71
You are designing an Azure Cosmos DB for NoSQL solution to store data from IoT devices. Writes from the devices will be occur every second. The following is a sample of the data. You need to select…
The correct answer is A. Create a new synthetic key that contains deviceId and timestamp. A synthetic partition key combining deviceId and timestamp (e.g., deviceId_timestamp) generates a high-cardinality set of unique values, distributing writes evenly across many logical partitions. This avoids hot partitions because no single partition key receives all the writes…
Question
You are designing an Azure Cosmos DB for NoSQL solution to store data from IoT devices. Writes from the devices will be occur every second. The following is a sample of the data. You need to select a partition key that meets the following requirements for writes:
- Minimizes the partition skew
- Avoids capacity limits
- Avoids hot partitions
What should you do?
Exhibit
Options
- ACreate a new synthetic key that contains deviceId and timestamp
- BUse timestamp as the partition key
- CUse deviceManufacturer as the partition key
- DUse sensor1Value as the partition key
How the community answered
(18 responses)- A83% (15)
- B11% (2)
- D6% (1)
Explanation
A synthetic partition key combining deviceId and timestamp (e.g., deviceId_timestamp) generates a high-cardinality set of unique values, distributing writes evenly across many logical partitions. This avoids hot partitions because no single partition key receives all the writes at any moment. Using timestamp alone creates a hot partition since all devices write to the same current-second timestamp. Using deviceManufacturer provides too few distinct values (low cardinality), causing skew toward popular manufacturers. Using sensor1Value has unpredictable distribution and limited cardinality for a partition key.
Topics
Community Discussion
No community discussion yet for this question.
