Scrivio Interview library
DesignAdvanced7 min read · updated 13 November 2026

Payment events must survive broker and zone failures, and in a cluster spread over three availability zones every replica that crosses a zone also adds network cost.

Choose replication settings for a payments topic in a cluster spread over three availability zones: replication factor, min.insync.replicas, producer acks and leader election settings. Explain exactly which failures lose data, which block writes, and what the cross-zone cost is.

For payments I would use replication factor 3 with one replica per zone, min.insync.replicas=2, acks=all, idempotent producers and unclean leader election off. Every acknowledged write is then in at least two zones: losing one zone keeps the partition writable, losing two zones (or one zone plus a lagging replica) blocks acks=all writes but loses nothing acknowledged, and data is lost only if every replica holding it fails together. Each produced byte crosses zones twice for replication, plus producer and consumer traffic to leaders in other zones, which follower fetching mostly removes for consumers.

Why this question is asked

Payment events are the kind of data where a lost record becomes a customer complaint or an accounting gap, so the replication settings are a business decision expressed in configuration. They also carry a running cost, because in cloud deployments cross-zone traffic is billed per gigabyte. Interviewers ask this to see whether we can state precisely which failures lose data, which only block writes, and what we pay for the protection. In this answer, we will recap each setting, choose values, walk through the failure cases, look at alternatives with stronger durability, estimate the cross-zone cost, and mention Eligible Leader Replicas.

1A Quick Recap of the Four Settings

Replication factor is how many copies of each partition exist. min.insync.replicas is the smallest ISR size at which the leader will accept an acks=all write. acks on the producer says when the write is acknowledged: acks=all waits until every current ISR member has the record. unclean.leader.election.enable decides whether a replica outside the ISR, which may be missing records, may become leader when no ISR member is alive.

The rack setting ties it to zones. Each broker is configured with broker.rack set to its zone, and Kafka's replica placement then puts a partition's replicas on different racks where it can. With three zones and replication factor 3, each partition gets one replica per zone.

2The Choice for Payments

Replication factor 3, one replica per zone, gives a copy in every failure domain. min.insync.replicas=2 means every acknowledged write is on at least two replicas, which, because they are on different racks, means at least two zones. acks=all makes the producer wait for that. enable.idempotence=true, the default since Kafka 3.0, makes retries safe, so a retry after a failover cannot duplicate a payment event. And unclean leader election stays off, its default, so a replica that might be missing acknowledged payments can never become leader on its own.

Properties
# topic
kafka-topics.sh --bootstrap-server b1:9092 --create --topic payments \
--partitions 24 --replication-factor 3 \
--config min.insync.replicas=2 --config unclean.leader.election.enable=false
# producer
acks=all
enable.idempotence=true
delivery.timeout.ms=120000
# each broker
broker.rack=eu-west-1a # its own zone

3Which Failures Lose Data and Which Block Writes

It helps to separate three outcomes: still writable, writes blocked but nothing lost, and acknowledged data lost. With our settings, losing one broker or one whole zone leaves two replicas; if both are in the ISR, the partition stays writable and a new leader is elected from them. Losing two zones leaves one replica; the ISR is below 2, so acks=all writes fail, but every acknowledged record is on that surviving replica, so nothing is lost. The same happens with one zone down and one of the remaining replicas lagging out of the ISR.

Acknowledged data is lost only when every replica that holds it fails together and cannot be recovered, for example the two ISR members' disks destroyed at once while the third replica was out of sync. With replicas in separate zones that is a rare, correlated event. Note the trap: if someone enables unclean election to restore availability, a lagging replica can become leader and the records it is missing are lost, which is why we keep it off for payments.

Outcomes with RF 3, min.insync.replicas 2, acks=all
FailureWritesAcknowledged data
One brokercontinuesafe
One zonecontinuesafe
One zone plus a lagging replicablockedsafe
Two zonesblockedsafe on the survivor
All replicas holding a record lostblockedlost
Unclean election after ISR lossresumerecords not on new leader lost
Most failures cost availability, not data.

4Stronger Options and Their Costs

Replication factor 4 with min.insync.replicas=3 would keep every acknowledged write on three replicas, so two simultaneous failures still lose nothing. The cost is a third more storage and cross-zone traffic, and with three zones one zone holds two replicas, so losing that zone leaves two of four, below 3, and blocks writes. min.insync.replicas=3 with replication factor 3 is stricter still: any single failure blocks writes. These options trade availability for durability.

The decision should come from the data's value and the failure history. If payment events can be rebuilt from an upstream ledger or an outbox table, three replicas with min.insync.replicas=2 is plenty. If Kafka is the only record, and the business cannot tolerate even a rare loss, the stronger settings, plus cross-region copies, become worth their cost.

5The Cross-Zone Cost

Every byte a producer writes is replicated from the leader to two followers, each in another zone, so it crosses zones twice. The producer also sends to a leader that is in another zone two times out of three, and consumers fetching from the leader cross zones two times out of three as well. So for 1 GB of payment events consumed by three services, the cross-zone volume is about 2 GB for replication, about 0.67 GB from producers and about 2 GB for consumers, close to 4.7 GB per gigabyte produced.

Follower fetching removes most of the consumer part: with replica.selector.class set to the rack-aware selector on brokers and client.rack set on consumers, each consumer reads from the replica in its own zone. Producer traffic can be reduced by placing producers near leaders, but replication traffic is the price of durability and stays.

6Eligible Leader Replicas

Newer Kafka releases add Eligible Leader Replicas, KIP-966. The idea is that when the ISR shrinks below min.insync.replicas, the controller keeps track of replicas that are known to hold all committed data even though they left the ISR, and allows one of them to be elected leader cleanly. That improves availability after certain failures without the data loss of an unclean election. It arrived in the 4.x line and its default has been changing between releases, so check whether it is enabled in your version before relying on it.

7Follow-up questions

What changes if the cluster only spans two zones?

With replication factor 3 across two zones, one zone holds two replicas. Losing that zone leaves one replica, below min.insync.replicas=2, so writes stop, and the controller quorum may lose its majority too if most voters were there. Replication factor 4 placed two and two with min.insync.replicas=3 guarantees each acknowledged write is in both zones but blocks writes whenever a zone is lost. To survive a zone loss and keep writing, we need a third location, even a small one for a controller voter and a replica, or a second cluster with asynchronous replication and its smaller guarantees.

Does acks=all with min.insync.replicas=1 make sense?

Not for payments. With min.insync.replicas=1, when the ISR shrinks to the leader alone, acks=all is acknowledged by the leader only, so a single broker failure can lose acknowledged data. acks=all only protects data when min.insync.replicas is at least 2.

Why idempotence for durability?

Idempotence is about duplicates, not loss, but the two meet during failover. Producers retry after leader changes, and without idempotence a retry of a batch that was written before the failure creates a duplicate payment event. With it, the broker recognises and drops the duplicate.

8Conclusion

In this answer, we chose replication factor 3 with one replica per zone, min.insync.replicas=2, acks=all, idempotence and no unclean election for payments. That keeps every acknowledged write in two zones, keeps writing through any single zone loss, blocks writes rather than losing data when two zones fail, and loses acknowledged data only if every replica holding it fails together. We saw what stronger settings cost, estimated cross-zone traffic at about twice the produced bytes for replication plus client traffic, cut the consumer share with follower fetching, and noted Eligible Leader Replicas in newer versions.

What to say in the interviewAbout 90 seconds aloud

Open with

For payments I would use replication factor 3 with brokers tagged by zone, so each partition has one replica per zone, min.insync.replicas of 2, producers with acks=all and idempotence on, and unclean leader election off.

Then, if they want more

That means every acknowledged write is on at least two brokers in two different zones. If one broker or a whole zone fails, the partition elects a new leader from the remaining in-sync replicas and keeps accepting writes.

If two zones fail, or one zone fails while another replica is lagging out of the ISR, acks=all writes are rejected, but nothing acknowledged is lost, because it is on the survivor.

We only lose acknowledged data if every replica that held it fails together and cannot be recovered, or if someone forces an unclean election, which is why it stays off. If the data is irreplaceable I could go to replication factor 4 or min ISR 3, but that blocks writes on more failures and costs more.

On cost, each produced byte crosses zones twice for replication, plus producer traffic to leaders in other zones and consumer reads. Follower fetching with client.rack and the rack-aware replica selector removes most of the consumer part.

Finally, newer versions have Eligible Leader Replicas, KIP-966, which can elect a replica known to have all committed data after the ISR shrank; I would check if it is enabled in our version.

About this answer

Last updated
13 November 2026
Versions it names
Kafka 3.0
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Apache Kafka documentation
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Choose replication settings for a payments topic in a cluster spread over three...": https://scrivio-interview-library.netlify.app/spring-boot/kafka-internals/f9f2746dce/