Spreading Kafka brokers across several zones in a region keeps the cluster up when one zone fails. The price is cross-zone traffic. Clouds charge per GB for transfer between zones even inside one region. In Kafka that traffic comes from three paths: produce, replication, and consume. Replication exists to put copies in other zones, so it does not shrink unless the placement changes. Produce has some room only for keyless records. The path you can cut the most while keeping the placement is consume. Follower fetching, introduced by Kafka Improvement Proposal KIP-392, lets a consumer read from a follower in its own zone instead of the leader.

I wanted to know which path drives the bill for zone-spread brokers, and how much availability each placement buys for that cost. I checked the cloud pricing pages and the Kafka docs, then ran three brokers on local Docker, split into racks, and measured egress before and after follower fetching.

Three Paths

The produce, replication, and consume paths crossing zone boundarieszone azone bzone cproducerconsumerbroker 1leaderbroker 2followerbroker 3followerproduceconsumeproducereplicationconsume

One partition with a replication factor (RF) of 3, spread over three zones. Every arrow that crosses a zone boundary is billed.

  • Produce: a producer writes only to the partition leader. It crosses zones when the producer and the leader are in different zones
  • Replication: followers pull data from the leader. It always crosses zones when a follower sits in another zone
  • Consume: by default a consumer reads from the leader. It crosses zones when the consumer and the leader are in different zones

The replication arrows point in the direction data flows. On the wire, the follower sends a fetch request to the leader and receives the data in the response.

Cloud Billing

Which side is billed for cross-zone transfer within a regionGCPVM · zone aVM · zone b1 GB transfersender $0.01/GiBreceiver not billedAWSVM · zone aVM · zone b1 GB transfersender $0.01/GBreceiver $0.01/GB

GCP and AWS list the same rate for cross-zone transfer within a region, but they bill different sides.

ItemGCPAWS
Cross-zone rate$0.01 / GiB$0.01 / GB
Billed sideThe sending VM’s project (“The cost is attributed to the project of the VM that is sending the traffic.”)Both sending and receiving sides (“you’re charged for both inbound and outbound traffic”)
Same zone, internal IPFreeFree
SourceVPC network pricing, VM-VM data transfer sectionPrice List API AWSDataTransfer us-east-1 (DataTransfer-Regional-Bytes), CUR data transfer docs
  • Checked on: I read both on 2026-11-17. The GCP page shows no update date; the AWS Price List response has publicationDate 2026-11-17T00:49:47Z
  • Units: GiB and GB follow each pricing page as written. The calculations below ignore the difference and use GB
  • AWS bills both sides: 1 GB sent once shows up as $0.01 on the sending instance and $0.01 on the receiving one, so the same traffic costs twice what it does on GCP
  • Replication lands on the brokers: brokers exchange replication traffic among themselves, so its charge goes to the broker VMs. On GCP that is the project of the sending leader broker
  • Managed services differ: Amazon MSK states “You are not charged for data transfer used for replication between brokers” and applies standard charges only to traffic between clients and the cluster

Cross-Zone Bytes per GB

Cross-zone bytes per 1 GB produced (RF3, three zones, clients spread evenly)Cross-zone bytes per 1 GB produced (RF3, 3 zones)default3.33 GB1 consumer groupdefault4.67 GB3 consumer groupsfollower fetching2.67 GB3 consumer groupsproducereplicationconsume

Assumptions: RF3, three zones, one broker per zone, and producers, consumers, and partition leaders spread evenly across zones.

  • Produce: a producer lands in a different zone from the leader 2/3 of the time, so writing 1 GB sends 0.67 GB across zones
  • Replication: both followers are in other zones, so 1 GB becomes 2 GB across zones
  • Consume: one consumer group reading everything sends 0.67 GB across zones for the same reason as produce. Three groups send 2 GB

The totals are 3.33 GB with one group and 4.67 GB with three. For 1 TB produced and one group, about 3.33 TB crosses zones: about $33 on GCP and about $67 on AWS, which bills both sides. Replication is the largest share at 2 TB, and consume grows with the number of groups.

Replication

When brokers have broker.rack set, Kafka places a partition’s replicas on different racks. The “Balancing replicas across racks” section of the Kafka docs says:

ensuring replicas span as many racks as they can (a partition will span min(#racks, replication-factor) different racks)

The same section notes the feature also applies to groupings “such as availability zones in EC2.” With zones as racks, RF3 over three zones puts one replica in each zone. Replication crossing zones follows directly from placing one replica per zone so data survives a zone failure. The usual ways to cut this path are a lower RF or fewer zones, and both reduce availability.

Produce

A producer can write only to the partition leader. If the leader is in another zone, that transfer is unavoidable. Records with a key go to the partition picked by the key’s hash, so the producer has no say in the zone either.

Keyless records now have an exception. KIP-1123 added rack awareness to the producer’s default partitioner, and since Kafka 4.4 the producer configs list partitioner.rack.aware (default false). With it and client.rack set, the sticky partition is chosen among partitions whose leader is in the same rack, falling back to all partitions when none is. I expect that if producer counts differ a lot between zones, per-partition write volume will skew the same way. The 4.1.0 image used below does not have this setting, so I did not reproduce it.

Follower Fetching

Which replica the consumer reads from, before and after follower fetchingDefault: reads from the leaderzone azone cbroker 1 · leaderbroker 3 · followerconsumerclient.rack=creplicatefetchFollower fetching: reads from the same-zone replicazone azone cbroker 1 · leaderbroker 3 · followerconsumerclient.rack=creplicatefetch

The consume path can shrink without changing the placement. KIP-392 states the motivation:

a common deployment is within an AWS region in which each availability zone is treated as a datacenter. However, currently consumers are limited to fetching only from the leader, so there is no easy way to leverage locality in order to reduce expensive cross-dc traffic.

Under the assumptions above, if every consumer reads from a same-zone replica, the consume path drops to zero. The total becomes 2.67 GB regardless of group count: about 20% less with one group and about 43% less with three.

Brokers and consumers both need settings (broker configs, consumer configs).

SettingWhereValueDocs
broker.rackbrokerzone name“Rack of the broker. This will be used in rack aware replication assignment for fault tolerance.”
replica.selector.classbrokerorg.apache.kafka.common.replica.RackAwareReplicaSelector“This is used by the broker to find the preferred read replica. By default, we use an implementation that returns the leader.”
client.rackconsumerthe consumer’s zone name“It corresponds with the broker config ‘broker.rack’”
  1. The consumer sends a fetch request to the leader, carrying its client.rack
  2. The leader’s ReplicaSelector picks a replica. RackAwareReplicaSelector looks for replicas in the consumer’s rack. If the leader is in that rack it picks the leader; otherwise it picks the most caught-up follower there. If no replica matches the rack, it returns the leader
  3. The fetch response names that replica in its PreferredReadReplica field
  4. From the next fetch on, the consumer reads from that replica

The docs list replica.selector.class with Update Mode read-only, so changing it needs a broker restart. On the consumer side only client.rack is needed; without it the consumer reads from the leader. KIP-392 notes two caveats:

  • Latency: a follower serves data only up to the high watermark. The leader learns the high watermark first and passes it to followers in fetch responses, so “follower fetching may have higher latency”
  • Retries: the KIP-392 design document describes a follower returning OFFSET_NOT_AVAILABLE when a consumer asks for an offset the follower has not received yet, and the consumer retrying. It also says out-of-range errors from a follower are handled only after the consumer re-checks the offset with the leader

Partitions with no replica in the consumer’s rack are still read from the leader, which happens when RF is smaller than the number of zones. KIP-881 addresses this case by matching consumer racks to replica racks during group partition assignment (range, sticky, and cooperative-sticky assignors).

Local Reproduction

I ran three brokers from the apache/kafka:4.1.0 image on Docker inside a colima VM (aarch64, 8 CPUs, 16 GiB). All three nodes run KRaft combined mode, acting as both broker and controller, with broker.rack set to a, b, and c. Zones are simulated with rack labels; all three containers share one Docker network in one VM, so nothing is billed.

-e KAFKA_PROCESS_ROLES=broker,controller
-e KAFKA_CONTROLLER_QUORUM_VOTERS=1@kz-1:9093,2@kz-2:9093,3@kz-3:9093
-e KAFKA_BROKER_RACK=a        # b on kz-2, c on kz-3
-e KAFKA_REPLICA_SELECTOR_CLASS=org.apache.kafka.common.replica.RackAwareReplicaSelector   # second run only

The topic has one partition with RF3, and an explicit replica assignment puts its leader on broker 1 (rack a). The consumer is set to client.rack=c so it behaves as if it lived in rack c.

$ kafka-topics.sh --create --topic zc-before --replica-assignment 1:2:3
Topic: zc-before  Partition: 0  Leader: 1  Replicas: 1,2,3  Isr: 1,2,3

I wrote 50,000 records of 1 KB (47.7 MiB of payload, about 50.0 MB) with acks=all, and one consumer read them all from the beginning. For each phase, broker egress is the difference in each container’s /sys/class/net/eth0/statistics/tx_bytes. That count also includes protocol overhead and control traffic such as heartbeats and metadata, on top of replication and consume data.

$ kafka-producer-perf-test.sh --topic zc-before --num-records 50000 --record-size 1000 \
    --throughput 2500 --producer-props bootstrap.servers=kz-1:9092 acks=all compression.type=none
$ kafka-consumer-perf-test.sh --topic zc-before --messages 50000 --consumer.config c.properties  # client.rack=c

Egress during produce was the same in both runs.

default selector          kz-1(rack a) 102.0 MB | kz-2(rack b) 0.3 MB | kz-3(rack c) 0.3 MB
RackAwareReplicaSelector  kz-1(rack a) 102.1 MB | kz-2(rack b) 0.7 MB | kz-3(rack c) 0.4 MB

The leader sent about twice what the producer wrote: one copy to each of the two followers. The selector has no effect on this path.

Per-broker egress during consume: with follower fetching, the rack c broker sends instead of the leaderBroker egress during consume (client.rack=c, 47.7 MiB read)broker 1 · rack aleader51.2 MB0.4 MBbroker 2 · rack bfollower0.3 MB0.6 MBbroker 3 · rack cfollower · same rack0.3 MB51.1 MBdefault selectorRackAwareReplicaSelector

During consume, the broker doing the sending changed.

default selector          kz-1(rack a) 51.2 MB | kz-2(rack b) 0.3 MB | kz-3(rack c)  0.3 MB
RackAwareReplicaSelector  kz-1(rack a)  0.4 MB | kz-2(rack b) 0.6 MB | kz-3(rack c) 51.1 MB
  • Default: broker 1 (rack a), the leader, sent 51.2 MB, the roughly 50.0 MB payload plus overhead. In real zones that is cross-zone traffic from a to c
  • Follower fetching: broker 3, in the consumer’s rack, sent the same amount, and broker 1 sent almost nothing. In real zones that traffic stays inside zone c

The consumer’s preferred-read-replica value that --print-metrics printed at the end was -1 in both runs. KIP-392 defines -1 as reading from the leader, yet in the follower fetching run the egress came from broker 3. The value is probably printed after the consumer finishes and does not reflect its state while reading. I did not confirm this, so I relied on broker egress.

The VM was busy with other containers using a lot of CPU. The first attempt failed with controller registration timeouts, so I gave the reproduction containers a high --cpu-shares and capped the producer at 2,500 records/s. Producer latency (about 41 s on average) is meaningless under these conditions, and I did not measure the latency difference from follower fetching. Only byte counts were measured, from one run per setting. After measuring, I removed the containers, volumes, and network.

Per-Zone Clusters

Replication paths: one rack-aware cluster vs one cluster per zoneOne cluster · zone as broker.rackzone azone bzone cbroker 1broker 2broker 3replication crosses zonesOne cluster per zone · RF3 in eachzone azone bzone cbroker 1broker 2broker 3broker 1broker 2broker 3broker 1broker 2broker 3replication stays in the zone · 3x brokers

Another way to remove cross-zone transfer is an independent cluster per zone. If clients write and read only their own zone’s cluster, all 3.33 TB per TB produced from the earlier calculation stays inside zones. The Kafka docs recommend the same approach for pipelines that span datacenters: a local cluster in each datacenter, with mirroring between clusters.

One rack-aware cluster fits when:

  • Writes and reads on the same topic must continue through a zone failure
  • Every consumer reads the full data set
  • Growing the broker count and the operational surface is hard

Per-zone clusters fit when:

  • Clients write and read only their own zone’s data
  • A zone’s data can be unavailable for a while when that zone fails
  • You can afford the people and nodes to run three clusters

Keeping RF3 in per-zone clusters means three brokers per zone, nine in total. Once a consumer needs the full data set, it has to read all three clusters or you add mirroring, and that traffic crosses zones again. Transfer cost goes down, and node and operations cost go up instead.

Two-Zone Placement

With two zones, losing the zone that holds two brokers stops acks=all writeszone A downzone A · 2 brokerszone B · 1 brokerbroker 1broker 2broker 3ISR 1 < min.insync.replicas=2 → NotEnoughReplicaszone B downzone A · 2 brokerszone B · 1 brokerbroker 1broker 2broker 3ISR 2 ≥ min.insync.replicas=2 → writes continue

RF3 over two zones splits replicas 2 + 1. If leaders are spread evenly across the three brokers, replication sends about 1.33 GB across zones per GB on average, less than the 2 GB with three zones. But with min.insync.replicas=2 and acks=all, the outcome depends on which zone fails. The topic config docs describe the case:

If acks=all and the current ISR set contains fewer than min.insync.replicas members, then the producer will raise an exception (either NotEnoughReplicas or NotEnoughReplicasAfterAppend).

  • The zone with two brokers fails: ISR drops to one, below min.insync.replicas, and acks=all writes are rejected
  • The zone with one broker fails: two ISR members remain and writes continue

Two-zone placement lowers replication transfer, but writes continue through the failure of only one of the two zones. You cannot choose which zone fails, so I would not call this placement zone-failure tolerant. Lowering min.insync.replicas to 1 keeps writes going, but data held by only one replica can disappear with that broker. Count cost per path and availability per failed zone.

Controller Quorum

Whether the quorum survives one zone failure, by how three controllers are placedzone azone bzone c3 in one zone2 + 11 + 1 + 1zone down: quorum keptzone down: quorum lost

In KRaft the controller quorum manages metadata. The KRaft docs say “A majority of the controllers must be alive in order to maintain availability. With 3 controllers, the cluster can tolerate 1 controller failure.” With three controllers, two must be alive.

  • All three in one zone: losing that zone loses the quorum. Even with brokers spread across zones, metadata changes and leader elections stop
  • 2 + 1: losing the zone with two controllers loses the quorum. In a two-zone placement that puts two brokers and two controllers in the same zone, the write stop and the quorum loss both happen on the same failure
  • 1 + 1 + 1: any single zone can fail and two remain

Broker placement and controller placement are set separately. If brokers span three zones, controllers need one per zone for that placement to survive a zone failure.

Summary

  • Replication: does not shrink while each zone holds a copy, and is the largest path at 2 GB per GB
  • Produce: follows the leader’s location; only keyless records can be steered with the rack-aware partitioner
  • Consume: can be cut by reading from a same-zone replica with replica.selector.class and client.rack. In the local reproduction the sending broker moved from the leader to the same-rack follower
  • Availability: two-zone placement and controller placement produce outcomes that must be counted apart from cost

Before settling on a placement, I would count transfer per path and failure outcome per zone separately.

References