Kafka Partitions & The Mega-Customer Bottleneck
Model Kafka consumer lag, partition hot-spots, and why adding workers cannot solve partition skew due to the 1-worker-per-partition invariant.
Kafka Partitions & The Mega-Customer Hot-Key Trap
Think of Kafka partitions like 4 checkout registers. If shoppers are directed to all 4 registers evenly, checkout is fast. But if a tour bus of 500 shoppers is forced to go to Lane 0, Lane 0 backs up for hours while Lanes 1, 2, and 3 are empty! Hiring 8 cashiers doesn't help because only 1 cashier can operate Register 0.
order-workersmurmur2(customer_id) % 4Test Customer Partition Keys & Composite Salting
Messages are split equally across all 4 lanes. Each worker processes tasks without delay. The queue is 100% drained with zero backlog!
Potential Fixes for Kafka Partition Skew
Normal accounts use tenant_id. For mega-accounts, append a deterministic salt: tenant_id + "#salt-" + (hash(order_id) % 4) to fan out across all lanes.
Decouple partition polling from execution. Worker-0 reads Partition 0 and feeds an in-memory worker pool keyed by order_id, processing 30 orders concurrently.
Route enterprise high-volume clients to orders.vip with 32 partitions, insulating standard clients on orders.standard from noisy neighbors.
Deep-Dive Technical Reading
Explore the engineering theory, mathematical foundations, and production Go implementations behind this simulator.
Experiencing architectural bottlenecks in production?
From connection starvation and p99 latency spikes to Kafka consumer lag, index optimization, and algorithm profiling.