Question 43 of 50
What is Replication Factor?
Question
"What is Replication Factor, and how would you choose the right value?"
What the interviewer wants to assess
Whether you understand replication factor as an availability decision with a real cost, not an arbitrary "just to be safe" number.
Resposta rápida
Replication Factor is the number of copies of each partition in a topic, spread across different brokers — one of them the leader, the rest followers. Replication factor 3 is the recommended production default, allowing you to tolerate losing at least one broker with no loss of confirmed data.
Resposta nível Sênior
The trade-off is direct: more replicas mean more fault tolerance, but also more disk, network, and replication I/O usage. Replication factor 1 is only acceptable in local development — any loss of the single broker hosting the partition means data loss. Replication factor 3 is the smallest number that lets you comfortably tolerate losing one broker, while still keeping more than one replica in the ISR during recovery — which is why it's the market standard. It's worth noting that replication factor alone doesn't protect against an entire availability zone going down, unless replicas are explicitly spread across different zones (rack awareness).
In-depth explanation
See "Replication Factor" and "When to increase the Replication Factor" in Chapter 5.
Exemplo financeiro
A card transactions topic runs with replication factor 3 and min.insync.replicas=2: every write with
acks=all is only confirmed after at least 2 of the 3 replicas have persisted it, guaranteeing the
transaction survives a broker going down right after confirmation.
"Replication Factor is about long-term backup"
Replication protects against broker failure in the short term, it's not a backup or disaster-recovery strategy across geographic regions — that would require cross-cluster replication (e.g., MirrorMaker), an additional layer.
Pode vir a seguir
Likely follow-ups: "what's the difference between Partition and Replication Factor?" and "what are Leader and Follower?".
Related chapters