Soru

Zorluk: OrtaStream Processing and Event Routing with Amazon Kinesis and EventBridge

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?

  1. Configure the producer application to use the courier ID as the partition key when putting records into the stream.Cevap
  2. B
    Configure the producer application to use the region code as the partition key when putting records into the stream.
  3. C
    Increase the execution timeout of the downstream consumer AWS Lambda function to allow it more time to process the stream data.
  4. D
    Deploy the consumer AWS Lambda function in a private VPC subnet without a NAT Gateway to reduce connection latency to the stream.

Cevap

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.

Adım Adım Çözüm

1
Analyze the cause of the ProvisionedThroughputExceededException errors on the producer application.
The errors occur during write operations (putting records) despite the total stream throughput being below the provisioned limits, which indicates uneven partition key distribution causing hot shards.
To identify why write throttling occurs at the shard level rather than the stream level.
2
Evaluate the entropy of the available attributes (courier ID and region code) to determine their suitability as partition keys.
The courier ID (UUID) is a high-entropy key with many unique values, whereas the region code (e.g., 'US-EAST') has low entropy with very few unique values.
Kinesis distributes data across shards using a hash of the partition key, meaning high-entropy keys distribute data more evenly.
3
Select the configuration that ensures even distribution across all shards.
Using the courier ID as the partition key ensures write requests are distributed uniformly across all shards, resolving the write throttling issue.
To utilize the full provisioned capacity of the stream and eliminate hot shards.

Anahtar Kavram

Kinesis Partition Key Selection and Hot Shards
Tahmini Süre:1m 30s
Bu soruyu puanla