Soru

Zorluk: KolayResolving DynamoDB Throttling and Key Distribution Issues

A mobile gaming application writes daily player high scores to an Amazon DynamoDB table. Although the table's total provisioned write capacity is significantly higher than the aggregate write rate, the application frequently experiences ProvisionedThroughputExceededException errors because all writes use the current date (e.g., YYYY-MM-DD) as the partition key. Which action should the developer take to resolve this throttling issue?

  1. A
    Increase the provisioned Write Capacity Units (WCUs) of the table until the errors stop occurring.
  2. Change the partition key design to combine the date with a random numerical suffix to distribute write requests across multiple partitions.Cevap
  3. C
    Replace the write operations with a Scan operation containing a FilterExpression to query the database items in parallel.
  4. D
    Adjust the processing queue's message visibility duration to handle the database write failures.

Cevap

Change the partition key design to combine the date with a random numerical suffix to distribute write requests across multiple partitions.
The correct answer is to modify the partition key design to include a random numerical suffix. This technique, known as write sharding, distributes the writes for a single day across multiple partition keys (e.g., YYYY-MM-DD.1, YYYY-MM-DD.2), thereby distributing the physical partition load and preventing ProvisionedThroughputExceededException errors.

Adım Adım Çözüm

1
Identify the cause of the throttling.
The application is encountering ProvisionedThroughputExceededException despite having high total provisioned capacity, indicating a hot partition key issue because all writes target the same partition key (the current date).
DynamoDB partitions data based on the partition key. If too many writes target the same key, that physical partition gets throttled regardless of the table's total provisioned throughput.
2
Select a solution that increases partition key entropy.
Add a random or calculated suffix (e.g., a number from 1 to N) to the date partition key.
This spreads the write requests across multiple distinct partition keys, distributing the workload across multiple physical partitions.

Anahtar Kavram

Resolving hot partition keys in Amazon DynamoDB by introducing write sharding (adding a random suffix) to distribute the load across multiple physical partitions.
Bu soruyu puanla