dkduckkit.dev

Cross-AZ latency

Latency & SRE

Cross-AZ latency is the round-trip time for network traffic between different availability zones within a single cloud region. Most cloud providers keep intra-region, cross-AZ latency below 2 ms RTT, but this adds up when it appears on the hot path. In AWS, cross-AZ data transfer is also billed per GB, making cross-AZ traffic both a latency concern and a cost concern for high-throughput systems.

Formula

Typical values: AWS same-region cross-AZ RTT: 0.3–1.5 ms. With Kafka RF=3 across 3 AZs, every produce request triggers at least one cross-AZ replication round-trip.

Why it matters in practice

Kafka clusters with a replication factor of 3 spread replicas across availability zones for durability. Every message produced with `acks=all` must wait for the slowest follower to acknowledge — and if that follower is in a different AZ, the cross-AZ RTT is on the critical path. Similarly, consumer applications that fetch from a non-local leader pay the cross-AZ penalty on every fetch request. Enabling `client.rack` configuration routes consumers to the nearest replica, eliminating unnecessary cross-AZ fetches.

Common mistakes

  • Ignoring cross-AZ latency in latency budget calculations — it appears small (< 2 ms) but is paid on every replication hop.
  • Not accounting for cross-AZ egress costs in high-throughput Kafka clusters — at 1 GB/s throughput with RF=3, cross-AZ transfer costs can dominate the infrastructure bill.
  • Placing stateful services (database leaders) in one AZ while application servers are in another — all traffic pays the cross-AZ penalty.