A developer is designing a real-time inventory management system for a global retail chain. Stock levels for millions of unique Stock Keeping Units (SKUs) across 500 warehouses are updated constantly. These updates are published to an Amazon Kinesis Data Stream. During peak sales events, the application's producers frequently encounter ProvisionedThroughputExceededException errors when writing to the stream, even though the overall write throughput of the stream is well below the stream's aggregate capacity. Which partition key design should the developer implement to resolve this issue?
- AUse the warehouse ID as the partition key to keep all events from the same location together in the same shard.
- Use the SKU as the partition key to distribute write operations evenly across all available shards.Cevap
- CUse a static partition key such as 'INVENTORY_UPDATE' to guarantee strict global ordering of all updates.
- DIncrease the execution timeout of the downstream AWS Lambda consumer function to allow it more time to process the throttled shard's backlog.
Cevap
Use the SKU as the partition key to distribute write operations evenly across all available shards.
Using the SKU as the partition key provides high entropy (millions of unique values) compared to the number of shards. This ensures that records are distributed evenly across all shards, preventing any single shard from becoming a bottleneck (hot shard) and resolving the ProvisionedThroughputExceededException.
Adım Adım Çözüm
Anahtar Kavram
Selecting high-entropy partition keys is crucial in Amazon Kinesis Data Streams to prevent uneven data distribution and avoid hot shards that trigger ProvisionedThroughputExceededException during writes.