---
title: "KIP-392 explained: fetch from the closest replica"
description: "KIP-392 in plain words: Kafka consumers can read from a follower in their own zone instead of the leader, cutting cross-zone traffic. Settings and caveats."
url: https://monedula.dev/kafka/kips/kip-392/
---

# KIP-392: consumers read from the closest replica

Consumer groups and queues · Shipped · since Kafka 2.4 · status checked November 2026.

KIP-392 lets a Kafka consumer read from a follower replica in its own rack or availability zone instead of always from the partition leader. In the cloud that removes most of the cross-zone traffic consumers cause, which is billed. It needs a replica selector on the brokers and client.rack on the consumer.

## At a glance

- Proposal: KIP-392, Allow consumers to fetch from closest replica
- Status: Shipped. Since Kafka 2.4 (2019), opt-in with replica.selector.class and client.rack.
- Area: Consumer groups and queues
- Proposal page: [KIP-392 on the Apache Kafka wiki](https://cwiki.apache.org/confluence/display/KAFKA/KIP-392%3A+Allow+consumers+to+fetch+from+closest+replica)

## Why it was needed

Before KIP-392 every fetch went to the leader. With leaders spread over three zones, about two thirds of all consumer traffic crossed a zone boundary, and in a multi-datacenter cluster consumers read across the WAN even when a full copy sat next to them.

## What it changes

The consumer sends its client.rack with each fetch. If the broker has a replica selector configured, the leader answers with a preferred read replica: an in-sync replica in the same rack, or itself if there is none. The consumer then fetches from that follower. A follower learns the high watermark only through replication, so new records reach follower readers a little later than leader readers.

## How to use it

- Set broker.rack on every broker and replica.selector.class to the rack-aware selector on the brokers.
- Set client.rack on each consumer to the zone it runs in.

## Where it stands

Shipped in Kafka 2.4 and widely used on cloud clusters. An offset the follower cannot serve yet returns OFFSET_NOT_AVAILABLE and the consumer retries, so reads stay correct.

## What comes next

Stable. Producers got the matching feature much later with rack-aware partitioning (KIP-1123, Kafka 4.4), and diskless topics (KIP-1150) aim at the replication traffic neither of them removes.

## See it in the simulator

- [Kafka KIP-392: consumers fetch from the closest replica](https://monedula.dev/kafka-simulator/scenarios/fetch-from-closest-replica/) (Fetch from the closest replica), step 3: Read from the follower in az-b. At 905 ms the followers' next fetch carried high watermark 1, and at 1000 ms g-near read O1 from broker-2, its preferred read replica: the in-sync replica in az-b. No consumer byte crossed a zone, at the cost of one fetch round (200 ms here) of freshness. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=02.1.5&t=2)
- [Diskless vs classic Kafka: cross-AZ replication traffic](https://monedula.dev/kafka-simulator/scenarios/no-cross-az-replication/) (No replication across AZs), step 4: The classic read crosses too. At 600 ms c-orders (g-orders, az-b) polled the 3 orders records. With the default replica.selector.class the classic read is served by the leader, broker-1 in az-a, so the read crossed from az-a to az-b and the card reads classic 7 · diskless 0: a consumer read counts one hop per partition read, not per record. (Real Kafka can let a consumer read from a follower in its own AZ with KIP-392: replica.selector.class=RackAwareReplicaSelector plus client.rack. The default LeaderSelector reads from the leader, as shown here, and replication would still cross AZs either way.) Meanwhile broker-1's buffer closed at 650 ms and its upload as wal-0001 started (600 ms upload, then a 200 ms commit): clicks HW 0, p-clicks still waiting. The upload goes to object storage, which the card does not count. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=06.1.2&t=3)
- [Diskless vs classic Kafka: cross-AZ replication traffic](https://monedula.dev/kafka-simulator/scenarios/no-cross-az-replication/) (No replication across AZs), step 2: Both batches land in az-a. At 150 ms both producers flushed 3 records. p-orders sent them to the orders leader, broker-1: its LEO is 3, the followers' are still 0 and the HW is 0. In the KIP-1163 draft any replica accepts a diskless produce and the client's own AZ is preferred, so p-clicks sent its 3 records to broker-1 as the az-a replica: WAL 3 under broker-1, no offsets yet. Neither produce crossed an AZ, but for orders that is luck of placement: a classic produce must go to the leader, wherever it is. Both producers are waiting; the card still reads classic 0 · diskless 0. [Open at this step](https://monedula.dev/kafka-simulator/playground/?scenario=06.1.2&t=1)

The simulator asks for the preferred read replica on every fetch, so a consumer goes back to its follower as soon as that follower is in sync again, and after OFFSET_NOT_AVAILABLE it retries the same follower. A Kafka consumer keeps the replica the leader named until a fetch error or its next metadata refresh (metadata.max.age.ms, 5 minutes by default), and after an error it asks the leader again. The diskless scenario keeps the default selector and shows the cross-zone leader read that KIP-392 avoids.

## Sources

- [KIP-392: Allow consumers to fetch from closest replica](https://cwiki.apache.org/confluence/display/KAFKA/KIP-392%3A+Allow+consumers+to+fetch+from+closest+replica)
- [Apache Kafka 4.4: broker configs](https://kafka.apache.org/44/configuration/broker-configs/)

## Related KIPs

- [KIP-1123 explained: rack-aware producer partitioning](https://monedula.dev/kafka/kips/kip-1123/)
- [KIP-1150 explained: diskless topics in Apache Kafka](https://monedula.dev/kafka/kips/kip-1150/)
