A developer is building a producer application that sends real-time traffic sensor data to an Amazon Kinesis data stream consisting of multiple shards. The developer wants to ensure that the data is distributed evenly across all available shards to prevent write throttling. Which partition key strategy should the developer implement?
- Use a high-entropy identifier, such as the unique sensor ID, as the partition key for each record.Cevap
- BUse a single, constant string value like 'sensor_data' as the partition key for all records.
- CUse a static partition key and increase the processing Lambda function's execution timeout.
- DUse the private subnet ID of the producer's VPC as the partition key.
Cevap
Use a high-entropy identifier, such as the unique sensor ID, as the partition key for each record.
The correct strategy is to use a high-entropy identifier, such as the unique sensor ID. Amazon Kinesis distributes incoming records to shards by hashing the partition key. A high-entropy partition key ensures that records are evenly distributed across all shards, minimizing the risk of hot shards and ingestion throttling.
Adım Adım Çözüm
Anahtar Kavram
Kinesis Data Streams Shard Distribution and Partition Keys