client.rack assigns a rack or location identifier to a Kafka client. Consumers use it to fetch records from a replica in the same rack or data center, reducing cross-location traffic; producers still send records to the partition leader. section 9.1.2 section 16.1.4
Apply client.rack with these operational considerations:
- Set it on consumers when brokers span data centers or availability zones and cross-location traffic is costly. section 16.1.4
- Pair it with broker rack identifiers so Kafka can represent broker locations and distribute replicas across fault domains. section 9.1.2
- Expect consumers to prefer a nearby replica, while producers continue communicating with the partition leader. section 9.1.2
Figure 9.1 The consumers are consuming from the nearest replica (in the same rack), but producers still have to produce to the leader of the partition.
Visualizes consumers reading from replicas in their rack while producers write to the partition leader. section 9.1.2
