Queues, Streams, Eventing
Kafka partitions: multiple-choice review
Six questions that cut across the whole unit. Each mirrors a call you make in a real Kafka design review — not a definition to recite, but a tradeoff to weigh before you touch a topic config.
Confirm you can connect key hashing, consumer-group assignment, the one-way door of partition count, hot-partition skew, and rebalancing — the synthesis the lesson built toward.
A topic has 8 partitions and a consumer group of 12 members, yet lag keeps climbing. What is the real constraint, and what actually fixes it?
An order-events topic is keyed by orderId on 6 partitions and lagging at peak. Per-order ordering must hold. Someone proposes raising it to 12 partitions in place. Why is that the trap, and what is the senior move?
One consumer in a healthy group is pegged at 100% CPU and lagging while the other five idle. Partition and consumer counts are balanced. What is happening, and where is the fix?
During a routine rolling deploy, consumption across an entire group halts for several seconds each time a pod restarts, even though only one consumer is replaced at a time. What is the cause, and what reduces it?
A team plans a topic and asks whether to provision 8 partitions for current load or 64 for headroom. What is the right framing?
A producer sends records with no key to a 6-partition topic, and a downstream consumer relies on processing events for the same entity in order. Why does this design fail, and what is the fix?
The through-line is one mechanism wearing three hats: hash(key) % N does distribution, per-key ordering, and co-location at once. From it everything follows — ordering holds only within a partition, consumer parallelism is hard-capped at the partition count, and changing N rehashes keys and breaks per-key order, so the count is a one-way door you provision for up front rather than tune. The two production failures, hot-partition skew (fix at the key level) and stop-the-world rebalances (tamed by cooperative rebalancing and static membership), both trace back to the same lesson: the key and the count are the real design decisions, and they are made before the topic exists.