Knowledge Guide
HomeSystem DesignKafka

hard Kafka Partitions: parallelism & ordering

A topic isn't one log — it's N independent ordered logs, and that split is the whole mechanism

A Kafka topic is physically split into partitions. Each partition is its own ordered, append-only log: records are appended at the tail and each gets a monotonically increasing offset that never changes once assigned. Splitting a topic this way gives partitions two jobs at once: they are the unit of parallelism — within one consumer group, exactly one consumer reads a given partition at a time — and the unit of ordering — Kafka guarantees order only within a single partition, never across the topic as a whole. Everything else about partitions (replication, placement, sizing) follows from those two jobs.

Topic orders split into 6 partitions; the producer partitioner routes key=user-42 deterministically to partition 2 via hash(key) mod 6, while unkeyed records spread across partitions with no cross-partition order; a consumer group of 3 consumers each owns 2 partitions
Topic orders split into 6 partitions; the producer partitioner routes key=user-42 deterministically to partition 2 via hash(key) mod 6, while unkeyed records spread across partitions with no cross-partition order; a consumer group of 3 consumers each owns 2 partitions

How a record picks its partition

The producer's partitioner decides, per record:

Traced: scaling the consumer group against 6 fixed partitions

Topic orders has 6 partitions and one consumer group, orders-svc. Kafka's group coordinator enforces a simple rule: each partition is assigned to exactly one consumer in the group at a time.

Consumers in groupAssignmentEffect
32 partitions each (C1, C2, C3)Balanced — every consumer pulls its weight
42, 2, 1, 16 doesn't divide evenly by 4 — some consumers do half the work of others
76 consumers get 1 each, 1 gets noneThe 7th consumer is provisioned but permanently idle

Adding or removing a group member triggers a rebalance — the coordinator reassigns partitions (briefly pausing the ones that move) using an assignor (range, round-robin, or the incremental cooperative-sticky assignor, which avoids the older stop-the-world pause). No assignor can invent partitions that don't exist — it can only redistribute what's there, which is why consumer #7 above is unavoidably idle.

Three scaling scenarios for a 6-partition topic: 3 consumers get 2 partitions each (balanced), 4 consumers get 2,2,1,1 (uneven), and 7 consumers leave one consumer idle with 0 partitions, showing partition count as a hard parallelism ceiling
Three scaling scenarios for a 6-partition topic: 3 consumers get 2 partitions each (balanced), 4 consumers get 2,2,1,1 (uneven), and 7 consumers leave one consumer idle with 0 partitions, showing partition count as a hard parallelism ceiling

Pitfalls

Judgment layer

Takeaways


Re-authored for this guide from Apache Kafka's documentation on partitions and consumer groups (group coordinator, partition assignors), KIP-480 (Sticky Partitioner), and standard Kafka operational guidance on partition sizing. Diagrams hand-authored as SVG for this guide. See also: Kafka Internals — Partitions, Offsets & Consumer Groups; Message Ordering; Shard Keys: many-key skew vs a single hot key; Rate-Limit Hot Keys.

🤖 Don't fully get this? Learn it with Claude

Stuck on Kafka Partitions: parallelism & ordering? Open Claude, copy a block below, and it'll teach you this exact concept — visually and interactively.

🎨 Explain it visually

Build the mental picture, not memorization.

I just read a lesson on **Kafka Partitions: parallelism & ordering** (System Design) and want to truly understand it. Explain Kafka Partitions: parallelism & ordering from first principles using ONE vivid real-world analogy and a visual mental model — draw it as ASCII art or a clear step-by-step diagram — with a concrete example using real numbers. Then ask me one question to check I got the mental picture, and wait for my reply. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🤔 Walk me through it (interactive)

Socratic — adapts to where you're stuck.

Teach me **Kafka Partitions: parallelism & ordering** interactively. Ask me ONE guiding question at a time, wait for my answer, and adapt to my confusion — build the idea with me step by step instead of explaining it all at once. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧪 Quiz me & fix my gaps

Active recall exposes what you missed.

Quiz me on **Kafka Partitions: parallelism & ordering** with 5 questions, easy to tricky, ONE at a time. Tell me if each answer is right; at the end, explain clearly what I got wrong and why. If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.
🧠 Make it stick

Intuition + hook + flashcards for long-term memory.

Help me remember **Kafka Partitions: parallelism & ordering** for the long term: give the one-sentence intuition, a memorable hook/mnemonic, a tiny worked example, and 3 active-recall flashcards (Q -> A). If you're unsure or a claim isn't standard, say so and reason from first principles instead of guessing.

📝 My notes