Skip to main content
AutoMQ’s shared storage architecture, based on S3, can prevent cross-AZ replica replication between brokers and cross-AZ data read/write traffic from clients. This document describes how to use AutoMQ to save on cross-AZ transfer traffic.
The AZ mentioned in this article stands for Available Zone, specifically referring to the availability zones provided by cloud vendors in public cloud environments. Each independent AZ may have its own separate data center facilities.

Background

Apache Kafka Cross-AZ Traffic Analysis

When users deploy Apache Kafka across multiple AZs in cloud environments like AWS and GCP, they can achieve multi-AZ service disaster recovery. However, this also incurs cross-AZ data transfer costs, which can account for 60-70% of the total cost in large-scale clusters.
  • Cross-AZ Production Traffic: Assuming the Producer has not set a ShardingKey and partitions are evenly distributed among cluster nodes, at least 2/3 of the Producer traffic will be sent across AZs. For example, 1/3 of the traffic from a Producer in AZ1 will be sent to AZ2 and AZ3 respectively.
  • Server-side Cross-AZ Replication Traffic: After a Kafka Broker receives a message, to ensure high data reliability, it replicates the data to Brokers in other AZs, generating twice the amount of Produce cross-AZ traffic.
  • Cross-AZ Consumption Traffic: Consumers can avoid generating cross-AZ traffic by setting client.rack to consume from partitions/replicas in the same AZ.

AutoMQ Eliminates Cross-AZ Data Transfer

AutoMQ uses S3 to implement a storage-compute separation architecture. Based on S3, AutoMQ achieves zero cross-AZ traffic costs:
  • Production Traffic: AutoMQ’s built-in Proxy layer intercepts and identifies cross-AZ Produce requests. It builds a cross-AZ proxy channel based on S3 to forward Produce requests to the true partition Leader. Producers only need to communicate with Broker nodes in the same AZ, resulting in no cross-AZ traffic costs.
  • Replication Traffic: AutoMQ uses S3 as a shared storage layer. S3 uses erasure coding to generate multiple replicas across multiple AZs. There is no replication traffic between AutoMQ Broker nodes as in Apache Kafka.
  • Consumption Traffic: In addition to the Leader partition, AutoMQ generates a read-only partition in each of the other AZs. The read-only partition reads data written by the Leader partition directly from S3 on demand. Consumers only need to communicate with the Leader partition or the read-only partition in the same AZ, resulting in no cross-AZ traffic costs.

Configuration Documents

To use AutoMQ’s cross-AZ data routing feature to eliminate cross-AZ data transfer, you need to enable configurations on both the server and client sides. The relevant configuration documents are as follows: After completing the configuration, you can perform data sending and receiving tests and refer to the Monitor Cross-AZ Traffic▸ document to observe the actual cross-AZ traffic generated.