Question

Difficulty: MediumResolving DynamoDB Throttling and Key Distribution Issues

An e-commerce checkout application named CartCheckout records transaction logs in Amazon DynamoDB. The table uses CheckoutDate (formatted as YYYY-MM-DD) as the partition key and TransactionID as the sort key. During a flash sale event, the application experiences multiple ProvisionedThroughputExceededException errors when writing to the table, even though the total consumed Write Capacity Units (WCUs) are well below the table's total provisioned limits. Which action should the developer take to resolve the write throttling and optimize the table's write performance?

  1. Redesign the partition key schema to use the high-entropy TransactionID as the partition key, or append a random suffix to the CheckoutDate, to distribute writes evenly across partitions.Answer
  2. B
    Increase the overall provisioned Write Capacity Units (WCUs) of the DynamoDB table to handle the high volume of write traffic during the flash sale.
  3. C
    Place an Amazon SQS queue in front of the DynamoDB table and configure a longer queue visibility timeout to prevent write failures.
  4. D
    Configure the application SDK client initialization by hardcoding AWS IAM access keys with higher write privileges to prevent API rate limiting.

Answer

Redesign the partition key schema to use the high-entropy TransactionID as the partition key, or append a random suffix to the CheckoutDate, to distribute writes evenly across partitions.
The correct answer is correct because replacing the partition key with a high-entropy key (like TransactionID) or adding a random suffix to the date distributes the data and request load evenly across all available physical partitions. This avoids hot partition bottlenecks where a single partition key receives all writes.

Step-by-Step Solution

1
Analyze the error message and table configuration to determine the root cause of throttling.
The ProvisionedThroughputExceededException combined with low overall table throughput indicates a hot partition issue due to poor partition key distribution.
Since the partition key is CheckoutDate (YYYY-MM-DD), all transaction writes on the day of the flash sale target the same partition, exceeding the throughput limit of a single physical partition.
2
Evaluate remediation strategies to distribute the write load more evenly across partitions.
A high-entropy attribute like TransactionID should be selected as the partition key, or write sharding (appending a random suffix) should be implemented on the CheckoutDate.
This spreads writes across multiple partition keys and therefore multiple physical partitions, utilizing the table's provisioned capacity effectively.

Key Concept

Identifying and resolving hot partitions in Amazon DynamoDB by designing high-entropy partition keys or implementing write sharding.
Rate this question