Skip to content
Kafka Is Fun

IntermediateOperations

What is rack awareness in Kafka and why is it important?

Reference answer

Rack awareness spreads the replicas of a partition across different failure domains (racks), so that a rack failure does not remove every copy; the docs say it can also be applied to other groupings such as availability zones in EC2. You set broker.rack on each broker (for example broker.rack=my-rack-id). When a topic is created or modified, or replicas are redistributed, the rack constraint is honoured, so a partition spans min(number of racks, replication factor) different racks. The replica assignment algorithm keeps the number of leaders per broker constant regardless of how brokers are spread over racks, which balances throughput. If racks hold different numbers of brokers, replicas are distributed unevenly (racks with fewer brokers get more replicas), so an equal number of brokers per rack is sensible. In the cloud a common approach is one availability zone per rack; with a replication factor of 3 across 3 zones each zone holds one replica, so losing a zone leaves two replicas, and whether writes continue then also depends on min.insync.replicas.

Expected key concepts: rack awareness, broker.rack, racks, failure domains, availability zones, replica assignment, replication factor, leaders per broker, min.insync.replicas

How did that feel?

Your own verdict, not the score. It shows up next to this question in the list, so you can come back to the shaky ones.