Dynamodb medium
In a nationwide voting application, a single candidate receives 50,000 votes per second. How can this exceed the 1,000 WCU partition limit using 'Write Sharding'?
- A By increasing the provisioned capacity to 50,000 WCU immediately.
- B Partition Suffixes: Instead of one item `CANDIDATE_A`, create 100 items (`CANDIDATE_A_1` through `CANDIDATE_A_100`). Each vote is sent to a random suffix, spreading the 50,000 WCU across 100 partitions.
- C By enabling DAX (DynamoDB Accelerator) for write-heavy traffic.
- D By converting the Votes from 'Strong Consistency' to 'Eventual Consistency'.
Answer: B. Partition Suffixes: Instead of one item `CANDIDATE_A`, create 100 items (`CANDIDATE_A_1` through `CANDIDATE_A_100`). Each vote is sent to a random suffix, spreading the 50,000 WCU across 100 partitions.
This is a classic 'Vertical Limit' problem. A single Partition Key cannot exceed 1,000 WCUs. To break this barrier, you must 'Shard' the hot key. The application then performs a 'Scatter-Gather' read, summing up all 100 shards to get the final tally. This allows for near-infinite write scalability at the cost of slight read complexity.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- DynamoDB has a strict 400KB limit on the size of a single item. What is the recommended design pattern if you need to store larger documents (e.g., 5MB PDFs)?
- What is the primary role of the 'Partition Key' in ensuring DynamoDB's infinite horizontal scalability?
- Why is the `Query` operation generally preferred over `Scan` for production workloads in DynamoDB?
- DynamoDB is a 'fully managed' serverless database. What is a primary operational benefit of this model for an engineering team?
- In 'Provisioned Capacity' mode, how is the performance budget of a DynamoDB table defined?
- When would an architect choose to implement DAX (DynamoDB Accelerator) in front of an existing DynamoDB table?