An organization is designing a fleet management system using Azure Cosmos DB for NoSQL to store telemetry data from active delivery vehicles. Each vehicle uploads a status message containing `VehicleId`, `CurrentStatus` (which can be 'Active', 'Idle', or 'Maintenance'), and `Timestamp` every seconds. The database must sustain high-throughput write operations and handle queries that retrieve the telemetry history for a specific vehicle. Additionally, the database must remain available for reads even during a regional outage. Which design configuration should you recommend?
- Configure the container with VehicleId as the partition key and add a secondary region to the Azure Cosmos DB account.Answer
- BConfigure the container with CurrentStatus as the partition key and add a secondary region to the Azure Cosmos DB account.
- CConfigure the container with VehicleId as the partition key and configure the account to use locally redundant storage (LRS) as the primary mechanism for surviving regional failures.
- DConfigure the container with VehicleId as the partition key and distribute a Shared Access Signature (SAS) token with a 5-year expiration directly to all vehicles to perform database writes.
Answer
Configure the container with VehicleId as the partition key and add a secondary region to the Azure Cosmos DB account.
The correct design uses VehicleId as the partition key because it has high cardinality ( unique values) and aligns with the query pattern, which distributes throughput evenly. Adding a secondary region ensures that the database remains available for reads if the primary region experiences an outage.
Step-by-Step Solution
Key Concept
Azure Cosmos DB Partition Key Selection and High Availability