A customer loyalty rewards platform named "LoyaltyLink" processes member transactions and records reward point updates in an Amazon DynamoDB table. During a flash sale event, the application experiences a high volume of writes and starts throwing `ProvisionedThroughputExceededException` errors. The DynamoDB table partition key is `transaction_date` (formatted as YYYY-MM-DD), and the sort key is `member_id`. Although the total write throughput is well within the table's provisioned write capacity units (WCUs), the requests are heavily skewed towards the current date, causing throttling on a single partition. Which of the following approaches should a developer implement to resolve this throttling issue?
- Redesign the partition key schema by appending a random suffix (such as a number from to ) to the `transaction_date` partition key during writes, and update the application logic to query across all salted partitions.Answer
- BIncrease the provisioned Write Capacity Units (WCUs) of the DynamoDB table to to accommodate the temporary spike in write activity.
- CIntegrate an Amazon SQS queue to buffer write requests and increase the SQS visibility timeout to seconds to prevent message processing duplicates.
- DReconfigure the application to perform parallel Scan operations across segments to distribute the write workload evenly across the physical partitions.
Answer
Redesign the partition key schema by appending a random suffix (such as a number from to ) to the `transaction_date` partition key during writes, and update the application logic to query across all salted partitions.
The correct answer is to redesign the partition key schema by appending a random suffix to the `transaction_date` partition key during writes. Because DynamoDB partitions have a maximum write throughput limit of WCUs, using a partition key with low cardinality (such as a single date for all transactions on that day) causes all writes to target a single partition, resulting in throttling. Adding a random suffix (salting) distributes the items across multiple partitions, overcoming the single-partition write limit.
Step-by-Step Solution
Key Concept
Handling DynamoDB hot partition keys using write sharding (salting) to distribute throughput across physical partitions.