Skip to main content

Question 44 of 50

What's the difference between Partition and Replication Factor?

Mid-levelSenior

Question

"What's the difference between a topic's number of Partitions and its Replication Factor?"

What the interviewer wants to assess

A common confusion among beginners is treating the two as the same "scale" thing. This question separates candidates who understand a topic's two independent design axes.

Resposta rápida

Partition defines how many independent slices a topic is split into — the basis for consumption parallelism and write load distribution. Replication Factor defines how many copies exist of each of those partitions, on different brokers — the basis for fault tolerance.

Resposta nível Sênior

They're two completely independent design axes. A topic with 12 partitions and replication factor 3 has, in practice, 36 physical replicas spread across the cluster (12 partitions × 3 copies each). Increasing partitions increases consumption parallelism and write scale, but doesn't affect availability by itself. Increasing replication factor increases tolerance to broker loss, but doesn't affect parallelism — more replicas of the same partition don't let more consumers process it simultaneously, because client reads and writes only happen through that partition's leader.

In-depth explanation

See Chapter 4 (partitions) and Chapter 5 (replication factor).

Exemplo financeiro

A pix.recebido topic with 24 partitions and replication factor 3 has 24 leaders and 48 follower replicas spread across the cluster's brokers — 24 is the consumption parallelism ceiling; 3 is the fault tolerance of each of those 24 slices.

"More Replication Factor means more consumption parallelism"

No — additional replicas of a partition exist exclusively for fault tolerance (leader failover). They aren't read by consumers in parallel with the leader; only the leader serves clients in the default configuration.

Pode vir a seguir

Likely follow-ups: "what are Leader and Follower?" and "what happens when the Leader goes down?".