The Hot Partition
We quadrupled the partitions. Why is the lag on partition 7 exactly the same?
此挑战尚未翻译为简体中文,你正在阅读英文版本。
任务:Spread the load so no partition exceeds its consumer capacity, without breaking per-order ordering.
Larkspur's marketplace events are keyed by seller. Since MegaMart joined, it produces 40% of all events. One partition's consumer can't keep up, while the others idle. Downstream, the only real ordering requirement is per order.
任务: Spread the load so no partition exceeds its consumer capacity, without breaking per-order ordering.
学习目标
- Recognise key skew as the cause of hot partitions.
- Pick a key matching the actual ordering requirement.
- Understand what salting gains and loses.
模拟模拟数据
producer.send(new ProducerRecord<>("marketplace-events", event.sellerId(), event));// seller "MegaMart" produces 40% of all events → one partition gets 40% of the traffic