Overview
This guide demonstrates how to optimize cross-Availability Zone (AZ) traffic using AZ-aware Kafka consumers in your StarTree Pinot cluster. This guide covers the following key areas:- Understanding the need for cross-AZ traffic optimization
- High level approach
- Implementation details
The Problem
In a StarTree Pinot cluster, Pinot servers utilize low-level Kafka consumers to retrieve data from Kafka brokers. When a Pinot consumer operates in a different Availability Zone than the broker hosting the required partition, each fetch request generates cross-AZ network traffic. Cross-AZ traffic for Kafka consumers creates several challenges:- Increased costs: Cross-AZ data transfer incurs additional charges
- Higher latency: Network requests across zones introduce additional delay
- Reduced reliability: Cross-zone communication increases potential failure points
- Improved application performance through reduced latency
- Significant cost savings on data transfer fees
- Enhanced system reliability and fault tolerance

Solution Architecture
The optimization strategy centers on implementing AZ-aware Kafka consumers using the Kafka RackAwareReplicaSelector. This approach ensures that Pinot servers preferentially consume from Kafka brokers within the same Availability Zone.
- Step 1: Implement AZ-Aware Instance Assignment Configure the instance assignment strategy to consider Availability Zone placement when distributing workloads across the cluster.
- Step 3: Configure AZ-Aware Table Settings
Implementation details
Make instance assignment AZ-aware
First thing to do is setup pool-based instance assignment, wherein we tag servers in the same AZ with the same name (eg CLOUD_AZ_POOL_REALTIME). For example, set servers in aps1-az1 with value 0, aps1-az2 with value 1, etc.Make table configuration AZ-aware
When we create realtime table, configure client.rackExample config: