A media company is launching a live video streaming service where millions of viewers can post comments simultaneously during a broadcast. The application uses an Amazon DynamoDB table to store the comments. The table is designed with `broadcast_id` as the partition key and `comment_timestamp` as the sort key. During a stress test simulating 30,000 writes per second for a single live broadcast, the application experiences widespread write throttling, even though the table's provisioned write capacity is set to 35,000 Write Capacity Units (WCUs). Which database architecture modification should a solutions architect implement to resolve the performance bottleneck?
- Modify the table schema to append a random integer suffix to the partition key value, distributing the write operations across multiple physical partitions, and query across all partition suffixes to retrieve the comments.Answer
- BChange the table's partition key to `comment_timestamp` to ensure that write operations are distributed sequentially and evenly over time as comments are posted.
- CMigrate the database layer to an Amazon RDS for PostgreSQL database, configuring multiple read replicas in different Availability Zones to act as the primary automatic failover targets and absorb the high write throughput.
- DSwitch the DynamoDB table from provisioned capacity mode to on-demand capacity mode to allow the database to automatically partition and scale to support the peak write throughput without throttling.
Answer
Modify the table schema to append a random integer suffix to the partition key value (write sharding), distributing the write operations across multiple physical partitions.
The correct solution uses write sharding (adding a synthetic suffix to the partition key) to distribute write operations across multiple physical partitions. This design bypasses the physical limit of 1,000 WCUs per partition key in DynamoDB.
Step-by-Step Solution
Key Concept
DynamoDB partition design and write sharding to scale throughput.
Estimated Time:2m 0s