A developer is troubleshooting an application named PagePublish that stores metadata for online articles in an Amazon DynamoDB table. The table is configured with provisioned read capacity and uses ArticleStatus (such as DRAFT or PUBLISHED) as the partition key. During peak traffic hours, users experience high latency, and the application logs show numerous ProvisionedThroughputExceededException errors. Upon reviewing CloudWatch metrics, the developer notes that the read capacity is heavily consumed on a single partition, while other partitions remain idle. Which of the following is the most effective way to resolve this issue and prevent future throttling?
- AIncrease the provisioned Read Capacity Units (RCUs) for the table to handle the traffic spikes during peak hours.
- BModify the application to perform a Scan operation instead of a Query, and apply a filter expression on the client side to retrieve the articles.
- Redesign the table schema to use a more granular attribute, such as ArticleID, as the partition key.Answer
- DIncrease the visibility timeout of the Amazon SQS queue that processes retrieval requests to give the table more time to process requests.
Answer
Redesign the table schema to use a more granular attribute, such as ArticleID, as the partition key.
Redesigning the table schema to use a more granular attribute like ArticleID ensures that write and read requests are evenly distributed across multiple physical partitions. Since DynamoDB allocates partition capacity based on the partition key value, high-cardinality keys prevent hot partitions and eliminate ProvisionedThroughputExceededException errors caused by uneven traffic distribution.
Step-by-Step Solution
Key Concept
Resolving DynamoDB hot partitions by using a high-cardinality partition key design.
Estimated Time:1m 30s