Soru

Zorluk: ZorResolving DynamoDB Throttling and Key Distribution Issues

RideFlow is a ride-sharing platform that logs completed trips to an Amazon DynamoDB table. The table is configured with provisioned write capacity. The table's partition key is CityID and the sort key is TripTimestamp. During peak commute times, the platform experiences a high volume of writes for the city code NYC. As a result, the application logs ProvisionedThroughputExceededException errors, even though the total consumed write capacity units (WCUs) for the entire table are significantly below the provisioned threshold. Which strategy should a developer implement to resolve this throttling issue?

  1. Modify the write logic to append a random numeric suffix to the CityID partition key, distributing the write workload across multiple partition keys.Cevap
  2. B
    Increase the visibility timeout of the upstream Amazon SQS queue that processes trip writes to allow the consumer more time to write to the table.
  3. C
    Modify the query logic to use a Scan operation with a filter expression on CityID and TripTimestamp to bypass partition level limits.
  4. D
    Hardcode the AWS credentials and configure a static retry limit of zero in the AWS SDK client configuration to prevent the SDK from retrying throttled requests.

Cevap

Modify the write logic to append a random numeric suffix to the CityID partition key, distributing the write workload across multiple partition keys.
The correct solution is to modify the write logic to append a random numeric suffix to the CityID partition key. A single DynamoDB partition is limited to 1,000 WCUs. Since 'NYC' has a high volume of writes during peak times, it exceeds this partition-level limit even if the table's overall provisioned throughput is underutilized. Appending a random suffix distributes the writes across multiple partition keys (e.g., NYC_1, NYC_2) and thus across multiple physical partitions, resolving the hot partition throttling.

Adım Adım Çözüm

1
Identify the cause of throttling from metrics
Determine that ProvisionedThroughputExceededException is occurring because writes are concentrated on a single partition key ('NYC') representing a hot partition.
DynamoDB partitions have a hard limit of 1,000 WCUs. Concentrating writes on a single key exhausts the partition's capacity even if the table's overall provisioned capacity is much higher.
2
Select a distribution mitigation strategy
Implement write sharding by appending a random suffix to the partition key.
By appending a random suffix (e.g., NYC_1, NYC_2), writes are distributed across multiple partition keys and therefore multiple physical partitions, avoiding the single-partition WCU limit.

Anahtar Kavram

Resolving hot partition keys and partition throttling via write sharding in DynamoDB.
Tahmini Süre:2m 0s
Bu soruyu puanla