Question

Difficulty: MediumStream Processing and Event Routing with Amazon Kinesis and EventBridge

A healthcare startup collects continuous heart rate data from thousands of wearable medical patches. The patches stream telemetry data to an Amazon Kinesis Data Stream that has 1212 shards. The stream is experiencing periodic `ProvisionedThroughputExceededException` errors during peak hours, and analysis reveals that a single shard is receiving over 80%80\% of the traffic because the developer chose `device_manufacturer` as the partition key. Which of the following changes to the partition key should the developer implement to resolve the throttling and distribute the load evenly across all shards?

  1. Change the partition key to a high-entropy value such as a combination of device_id and the telemetry timestamp.Answer
  2. B
    Change the partition key to a static string value like heart_rate_telemetry to group all incoming records.
  3. C
    Replace the Kinesis stream with an Amazon SQS queue and reduce the message visibility timeout below the average message processing time.
  4. D
    Move the processing Lambda function to a private VPC subnet without configuring a NAT Gateway or VPC endpoint.

Answer

Change the partition key to a high-entropy value such as a combination of device_id and the telemetry timestamp.
The correct answer resolves partition hotness by switching to a key with high entropy. By combining the unique device identifier with the event timestamp, the developer ensures a uniform distribution of hashed keys across the 1212 shards, mitigating ProvisionedThroughputExceededException errors.

Step-by-Step Solution

1
Analyze the distribution of records across the Kinesis shards.
Identify that the current key (device_manufacturer) has low entropy, resulting in a hot shard receiving 80%80\% of the data stream traffic.
Uneven write distribution is the primary cause of ProvisionedThroughputExceededException errors when overall capacity is sufficient but partition key cardinality is low.
2
Select a partition key strategy with high cardinality.
Choose a key combining device_id and the telemetry timestamp, which provides high entropy.
A high-entropy partition key ensures that the MD5 hashing algorithm evenly hashes payloads across the 1212 available shards, maximizing write throughput.

Key Concept

Selecting high-entropy partition keys to prevent hot shards in Kinesis Data Streams.

Alternative Method

Using an explicit hash key (ExplicitHashKey) in the PutRecord/PutRecords API calls to directly assign records to specific shards.
Estimated Time:1m 30s
Rate this question