Soru

Zorluk: ZorHigh-Performing Database Solutions

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?

  1. 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.Cevap
  2. B
    Change the table's partition key to `comment_timestamp` to ensure that write operations are distributed sequentially and evenly over time as comments are posted.
  3. C
    Migrate 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.
  4. D
    Switch 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.

Cevap

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.

Adım Adım Çözüm

1
Analyze the DynamoDB throttling behavior.
Determine that a single physical partition key is limited to a maximum of 1,000 Write Capacity Units (WCUs) per second.
Although the total table capacity is set to 35,000 WCUs, all writes for a single broadcast share the same `broadcast_id` partition key, targeting a single partition and causing throttling.
2
Implement write sharding by designing a synthetic partition key.
Append a random integer suffix (e.g., 1 to 30) to the `broadcast_id` partition key value.
This distributes the 30,000 writes per second across 30 distinct partition key values, ensuring each partition handles only about 1,000 writes per second, which stays within the single partition limit.
3
Adjust the application query logic.
Retrieve comments by querying across all suffix partitions and sorting/merging the results.
Because the data is split across multiple partition keys, the application must query all partitions to compile a complete list of comments.

Anahtar Kavram

DynamoDB partition design and write sharding to scale throughput.
Tahmini Süre:2m 0s
Bu soruyu puanla