Soru

Zorluk: OrtaConfigure Partition Keys and Partitioning Strategies in Azure Cosmos DB

A healthcare organization is designing a monitoring application that collects real-time telemetry from wearable patient devices and stores the data in an Azure Cosmos DB for NoSQL container. The application hosts 100,000100,000 active patient devices, each sending health metrics every 10 seconds10\text{ seconds}, resulting in a high volume of continuous writes. The primary query pattern retrieves telemetry data for a specific patient for a single calendar day to populate a daily dashboard. Telemetry data for a single patient is expected to grow by approximately 30 GB30\text{ GB} per year. Which partition key strategy should you implement to support the query requirements while preventing partition size limits and write hot spotting?

  1. Create a synthetic partition key by concatenating the patientId and date values (for example, patientId_YYYY-MM-DD).Cevap
  2. B
    Use patientId as the partition key.
  3. C
    Use date as the partition key.
  4. D
    Create a synthetic partition key by appending a random integer between 1 and 10 to patientId (for example, patientId_X).

Cevap

Create a synthetic partition key by concatenating the patientId and date values (for example, patientId_YYYY-MM-DD).
Concatenating the patient identifier and the date creates a synthetic partition key with high cardinality that distributes writes evenly across partitions. Because each logical partition contains only one day of telemetry for a single patient, it easily fits within the 20 GB partition limit. This partition key also aligns with the primary read query pattern, allowing the system to serve the daily dashboard through an efficient point read or single-partition query.

Adım Adım Çözüm

1
Analyze logical partition size limits in Azure Cosmos DB.
Each logical partition has a maximum limit of 20 GB.
Choosing patientId as a partition key would cause the data for a single patient to grow to 30 GB in a year, violating this hard limit.
2
Analyze write distribution and hot partitioning patterns.
Choosing date as the partition key would route all 100,000 patient writes to a single partition for the current day.
This creates a severe throughput bottleneck (hot partition) where all write operations compete for the same allocated request units (RUs).
3
Evaluate the synthetic partition key approach using patientId and date.
Concatenating patientId and date (patientId_YYYY-MM-DD) scopes each logical partition to a single day's data for a single patient.
This guarantees that logical partitions stay well below the 20 GB limit, distributes daily write ingestion across 100,000 distinct partitions, and allows single-partition queries for the daily dashboard.

Anahtar Kavram

Selecting or constructing a partition key in Azure Cosmos DB to distribute storage and throughput workloads evenly while satisfying application query patterns.
Bu soruyu puanla