A solutions architect is designing a real-time advertising analytics platform to ingest and store ad impression events. The platform receives millions of write operations per minute. The system must support querying data by `campaign_id` sorted by `timestamp` to display real-time campaign performance. There are fewer than active campaigns at any given time, but the traffic is distributed unevenly across them, with some popular campaigns receiving the majority of the impressions. Which database design strategy should the solutions architect implement to ensure high write throughput and avoid throttling in Amazon DynamoDB?
- AUse a partition key of campaign_id and a sort key of timestamp, and deploy an Amazon DynamoDB Accelerator (DAX) cluster to cache write requests.
- Create a partition key by appending a random integer suffix to the campaign_id, and use timestamp as the sort key.Cevap
- CUse campaign_id as the partition key and timestamp as the sort key directly.
- DUse timestamp as the partition key and campaign_id as the sort key.
Cevap
Create a partition key by appending a random integer suffix to the campaign_id, and use timestamp as the sort key.
The correct option is to append a random integer suffix to the campaign_id. In Amazon DynamoDB, a single partition can support up to Write Capacity Units (WCUs). If write traffic is concentrated on a small number of keys, it leads to hot partitions and throttling. Appending a random suffix (write sharding) distributes the writes for a single campaign across multiple partitions, maintaining high write performance.
Adım Adım Çözüm
Anahtar Kavram
Write sharding (using partition key suffixes) to distribute high-throughput write traffic evenly across DynamoDB partitions.
Tahmini Süre:1m 30s