Monedula

Scenario 03.3.1 · Rack-aware placement

Kafka broker.rack: rack-aware replica placement

Replication · Advanced · about 3 min · Apache Kafka 4.3

broker.rack spreads replicas across racks; a whole rack can fail and partitions stay available.

Run this scenario in the playground

Record O2 produced after rack-c failure - acks=all succeeds with 2 in-sync replicas. t+10.500s

O2 still commits: with 2 in-sync replicas per partition, acks=all + min.insync.replicas=2 stays satisfiable despite the lost rack - durability against a correlated rack/AZ failure.

Open at this step: step 4, Record O2 produced after rack-c failure - acks=all succeeds with 2 in-sync replicas

What you start with

When broker.rack is set, Kafka spreads a partition’s replicas across racks so no single rack holds them all. This cluster places three replicas over three racks; an entire rack (two brokers) is then killed to show the partition staying available.

Step by step

  1. Six-broker cluster ready - rack-aware assignment spreads each partition across rack-a / rack-b / rack-c t+0.000s Six brokers over three racks (2 per rack), broker.rack set. Rack-aware assignment places each partition's 3 replicas in three DIFFERENT racks - no rack ever holds two copies of the same partition. Open at this step: step 1, Six-broker cluster ready - rack-aware assignment spreads each partition across rack-a / rack-b / rack-c
  2. Record O1 produced and replicated across all three racks t+5.000s O1 commits with acks=all: the leader and both followers sit in different racks, so every rack now holds a copy of the record. Open at this step: step 2, Record O1 produced and replicated across all three racks
  3. broker-5 and broker-6 (whole rack-c) dead - leaders elected on surviving replicas, ISR ≥ 2 on every partition t+8.000s A whole-rack outage: both rack-c brokers die at once. Because placement was rack-aware, every partition loses exactly ONE replica - leaders re-elect on the survivors and the ISR holds at 2 = min.insync.replicas everywhere. Open at this step: step 3, broker-5 and broker-6 (whole rack-c) dead - leaders elected on surviving replicas, ISR ≥ 2 on every partition
  4. Record O2 produced after rack-c failure - acks=all succeeds with 2 in-sync replicas t+10.500s O2 still commits: with 2 in-sync replicas per partition, acks=all + min.insync.replicas=2 stays satisfiable despite the lost rack - durability against a correlated rack/AZ failure. Open at this step: step 4, Record O2 produced after rack-c failure - acks=all succeeds with 2 in-sync replicas

The takeaway

Rack-aware placement spreads each partition over min(#racks, RF) racks - here one replica per rack - so a full rack (or availability-zone) outage still leaves enough in-sync copies for the partition to keep serving.

Configs in this scenario

Embed this scenario

Paste this into a blog post, a course page or your team's docs. The scenario plays inside your page, and the link under it points readers to this walkthrough.

<iframe src="https://monedula.dev/kafka-simulator/embed/?scenario=03.3.1" title="Kafka Simulator: Rack-aware placement" width="100%" height="520" style="border:1px solid #d0d0d0;border-radius:8px" loading="lazy"></iframe>
<p><a href="https://monedula.dev/kafka-simulator/scenarios/rack-aware-placement/">Kafka broker.rack: rack-aware replica placement</a></p>

Further reading

Apache Kafka documentation

More in Replication

All scenarios