Soru

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

A developer is writing a producer application that sends temperature telemetry data from thousands of IoT devices to an Amazon Kinesis data stream with multiple shards. The developer wants to ensure that the data is distributed evenly across all available shards to prevent write throttling. Which strategy should the developer use when specifying the partition key for the PutRecord API call?

  1. A
    Use a static string such as 'sensor_data' as the partition key for all records.
  2. B
    Deploy the producer application in a private VPC subnet without a NAT Gateway to restrict access to a single shard.
  3. Use a unique device identifier or a generated UUID as the partition key for each record.Cevap
  4. D
    Configure the consumer Lambda function to run with the default 3-second timeout to force faster shard polling.

Cevap

Use a unique device identifier or a generated UUID as the partition key for each record.
Using a partition key with high entropy (such as a unique device identifier or a generated UUID) ensures that the MD5 hash of the partition key is distributed evenly across the hash ranges of all shards in the Kinesis stream. This prevents a single shard from receiving a disproportionate volume of data (hot shards) and avoids write throttling.

Adım Adım Çözüm

1
Analyze how Amazon Kinesis uses partition keys to distribute records across shards.
Kinesis applies an MD5 hash function to the partition key of each record to determine which shard the record is assigned to.
Understanding the hashing mechanism helps determine the necessary characteristics of a partition key for even distribution.
2
Compare the entropy of the partition key options.
A unique device identifier or UUID provides high entropy, whereas a static string ('sensor_data') provides zero entropy.
High entropy results in an even distribution of hash values across the entire shard space, preventing hot shards.

Anahtar Kavram

Partition key entropy and shard distribution in Amazon Kinesis
Bu soruyu puanla