A media company is launching a live interactive voting platform for a popular television tournament. During a 10-minute voting window, the platform must ingest a sudden burst of up to votes per second. Each vote payload consists of a unique `VoteID`, the `ContestantID` (representing one of 5 finalists), and a `Timestamp`. The platform requires microsecond-level latency to query real-time leaderboard statistics by `ContestantID` for display on the live broadcast. Which database architecture should a solutions architect recommend to support this scale and performance while preventing write throttling?
- AAmazon RDS for PostgreSQL Multi-AZ DB cluster with three read replicas, routing all write operations to the read replicas to distribute the transactional load, and utilizing Amazon ElastiCache for Redis to cache contestant vote totals.
- BAmazon DynamoDB in provisioned capacity mode with Auto Scaling enabled, using `ContestantID` as the partition key and `Timestamp` as the sort key, with a global secondary index (GSI) on `VoteID` to distribute the write operations.
- Amazon DynamoDB in on-demand capacity mode, using a composite primary key consisting of a partition key of `ContestantID` appended with a random integer suffix and a sort key of `Timestamp`, with Amazon DynamoDB Accelerator (DAX) deployed to cache read queries.Answer
- DAmazon DynamoDB in provisioned capacity mode, using `VoteID` as the partition key and a local secondary index (LSI) on `ContestantID` to query leaderboard statistics, with Amazon ElastiCache for Memcached caching the query results.
Answer
Amazon DynamoDB in on-demand capacity mode, using a composite primary key consisting of a partition key of ContestantID appended with a random integer suffix and a sort key of Timestamp, with Amazon DynamoDB Accelerator (DAX) deployed to cache read queries.
The correct architecture uses Amazon DynamoDB in on-demand capacity mode to handle the sudden, massive voting spikes that auto scaling with provisioned capacity cannot adapt to fast enough. Because there are only 5 contestants, using ContestantID directly as the partition key would limit writes to only 5 partitions. A single DynamoDB partition supports a maximum of write capacity units (WCUs) per second, so writes per second would cause massive throttling. Appending a random integer suffix (e.g., ContestantID_1 through ContestantID_100) shards the partition key, distributing the writes across many physical partitions to handle the throughput. Amazon DynamoDB Accelerator (DAX) is natively integrated with DynamoDB to provide microsecond-level read latency for the leaderboard queries.
Step-by-Step Solution
Key Concept
DynamoDB partition key sharding (write-sharding) and capacity mode selection for highly spiky, high-throughput database workloads.