A developer is configuring a multiplayer game server to send real-time player action logs to an Amazon Kinesis Data Stream with four shards. The developer notices that one shard is constantly throttled, causing the producer to receive ProvisionedThroughputExceededException errors, while the other three shards are barely utilized. Upon inspecting the application code, the developer finds that the partition key in the PutRecord API call is set to a constant string value: "PlayerAction". Which modification should the developer make to resolve this throttling issue?
- Change the partition key to use the unique ID of the player performing each action.Answer
- BChange the partition key to use the static name of the game server instance.
- CIncrease the visibility timeout of the Kinesis Data Stream consumer application.
- DModify the IAM trust policy of the game server role to allow cross-account access.
Answer
Change the partition key to use the unique ID of the player performing each action.
The correct answer is to use the unique ID of the player performing each action as the partition key. Amazon Kinesis Data Streams uses the partition key to group data by shard. The partition key is hashed, and the hash value determines which shard the record is assigned to. By using a high-entropy key like a unique player ID, data is distributed evenly across all shards, preventing any single shard from becoming a hot shard and causing throttling.
Step-by-Step Solution
Key Concept
Kinesis Shard Throttling and Partition Key Selection