A developer is building a high-volume clickstream analytics pipeline where web applications publish event data to Amazon Kinesis Data Streams. The stream is configured with 4 shards, but the developer notices ProvisionedThroughputExceededException errors during high traffic. Upon review, they find that the partition key is set to a constant string value 'clickstream_event'. Which two actions should the developer take to resolve the throttling errors and optimize stream throughput?
- Modify the producer application to use the unique session ID or user ID as the partition key for each record.Answer
- Increase the shard count of the Kinesis Data Stream to scale the write throughput capacity.Answer
- CModify the producer application to use a static value like the application environment name as the partition key.
- DDeploy the consumer Lambda function in a private VPC subnet without configuring a NAT Gateway or VPC endpoint.
- EIncrease the Lambda function execution timeout to its maximum limit to allow more processing time.
Answer
Modify the producer application to use the unique session ID or user ID as the partition key, and increase the shard count of the Kinesis Data Stream.
To resolve the throttling issues caused by a hot shard, the developer must select a partition key with high entropy (such as a unique session ID or user ID) so that data is distributed evenly across all shards. Additionally, if the overall volume exceeds the total capacity of the stream, increasing the shard count provides more aggregate throughput capacity.
Step-by-Step Solution
Key Concept
Partition key design and shard capacity scaling in Amazon Kinesis Data Streams