Advanced topic replication strategies in Kafka.

Instruction: Explain the different strategies for topic replication in Kafka and the scenarios in which each would be most beneficial.

Context: This question tests the candidate's knowledge of Kafka's replication mechanism, including leader election, in-sync replicas, and handling of node failures.

Updated

Official answer

Kafka replicates each partition across a configured replica set. The leader accepts writes and followers fetch its log. Clients commonly read from the leader, but supported rack-aware follower fetching can serve reads from a preferred replica; “all reads always use the leader” is too broad.

Replication factor controls the number of copies. Replica placement across failure domains, producer acknowledgements and the minimum in-sync policy determine the relevant durability/availability tradeoffs. These are not separate generic “synchronous versus asynchronous replication modes.” With acks=1, a producer may receive success before followers have copied the record. With acks=all, Kafka waits under the configured in-sync/commit rules; min.insync.replicas sets a required floor, not a request to acknowledge only that many arbitrary replicas.

For a conventional replication-factor-three, minimum-in-sync-two policy, losing enough healthy replicas stops qualifying writes rather than silently reducing the guarantee. Current eligible-leader-replica features refine safe leader eligibility and commit behavior; inspect the deployed feature level instead of assuming every safe leader must currently be in ISR. Allowing an unsafe unclean election trades possible data loss for availability.

Adding a broker does not itself rebalance all replicas. Plan and verify replica reassignment and leader distribution separately from consumer-group rebalancing. Monitor unavailable/under-replicated partitions, replica lag and movement load.

No setting protects against every correlated storage failure, deletion or operator mistake. Test the specified failures and restore procedures.

Replication design, eligible leader replicas, reassignment

Related Questions