A developer is maintaining a multiplayer online game that stores player state in an Amazon DynamoDB table. The table primary key consists of a partition key Region (e.g., 'US-East', 'EU-West') and a sort key PlayerID. During a peak tournament, players in the 'US-East' region experience latency and receive ProvisionedThroughputExceededException errors. CloudWatch metrics indicate that the table's overall consumed write capacity is well below the provisioned limit. Which action should the developer take to resolve this issue and prevent it from recurring?
- Redesign the primary key to use a partition key with higher cardinality, such as a combination of Region and a hashed suffix of PlayerID, to distribute write requests evenly across partitions.Answer
- BIncrease the overall provisioned Write Capacity Units (WCUs) of the DynamoDB table to accommodate the peak write throughput of the application.
- CModify the query operations to perform a table-wide Scan operation with a filter expression on Region to bypass the partition-level bottlenecks.
- DHardcode an IAM user access key and secret key with full DynamoDB access directly in the application code initialization to ensure the SDK has permissions to bypass throughput limits.
Answer
Redesign the primary key to use a partition key with higher cardinality, such as a combination of Region and a hashed suffix of PlayerID, to distribute write requests evenly across partitions.
Redesigning the primary key with higher cardinality (e.g., sharding/salting) distributes requests across multiple physical partitions, which prevents exceeding the 1,000 WCU limit on any single partition.
Step-by-Step Solution
Key Concept
DynamoDB partition key design and sharding to avoid hot partitions