A delivery dispatch service tracks the real-time coordinates of delivery couriers. The couriers' mobile applications publish location updates to an Amazon Kinesis Data Stream. The payload contains a courier ID (a UUID), a region code (such as 'US-EAST' or 'US-WEST'), and a timestamp. An AWS Lambda function processes these updates. During high-traffic events, the producer application receives ProvisionedThroughputExceededException errors when writing to the stream, even though the total stream throughput is well below its provisioned limits. The developer discovers that some shards are heavily loaded while others are underutilized. Which configuration change should the developer make to resolve this write throttling issue?
- Configure the producer application to use the courier ID as the partition key when putting records into the stream.Answer
- BConfigure the producer application to use the region code as the partition key when putting records into the stream.
- CIncrease the execution timeout of the downstream consumer AWS Lambda function to allow it more time to process the stream data.
- DDeploy the consumer AWS Lambda function in a private VPC subnet without a NAT Gateway to reduce connection latency to the stream.
Answer
Configure the producer application to use the courier ID as the partition key when putting records into the stream.
Using the high-entropy courier ID (UUID) as the partition key distributes write requests uniformly across all shards. Since Amazon Kinesis maps partition keys to shards using an MD5 hash, high-entropy keys ensure even utilization of shards and prevent ProvisionedThroughputExceededException errors during writes.
Step-by-Step Solution
Key Concept
Kinesis Partition Key Selection and Hot Shards
Estimated Time:1m 30s