SproutStackSproutStack home
IntermediateKafka

Orders must survive a broker failure

Replication factor 2, acks=1, and a requirement for zero acknowledged-message loss.

The setup today

The orders topic was created early on, when the cluster had two brokers. The cluster now has three. Producers were tuned for latency a while ago.

Current configuration

topic: orders   replication.factor: 2   min.insync.replicas: 1
producer: acks=1
unclean.leader.election.enable=false   # default

What you know

  • Last quarter a broker died and about 40 orders that customers saw as confirmed were never processed.
  • Producers can tolerate a few extra milliseconds per write.

The new requirement

The business requirement is now explicit: losing any single broker must never lose an order that a producer was told was written, and orders should keep flowing while one broker is down.

Make the call

2 questions · first-try answers earn the most XP

1. Which settings meet the requirement?
2. With the new settings, two of the three brokers go down at once. What happens?
What a strong answer also covers
  • Changing the replication factor of an existing topic needs a partition reassignment, so plan and throttle it.
  • Producers must treat a rejected write as a failure and retry or surface it, never as success.
  • Spread replicas across racks or availability zones, or one zone outage can take two copies at once.
  • Alert on under-replicated partitions: one more failure there and writes stop.
Variations to think through

Change one fact and decide again. There is no single right answer here.

  • The cluster spans three availability zones with one broker in each. What does losing a zone do to writes?
  • The latency target tightens to 5 ms per write at p99. What would you trade, and how would you explain the risk?
  • A broker's disk fills up. What happens to its partitions and to the in-sync replica count?

The background

More drills