pjl1070048431 opened a new pull request, #19858: URL: https://github.com/apache/kafka/pull/19858
**Motivation** Kafka clusters typically require rebalancing of topic replicas after horizontal scaling to evenly distribute the load across new and existing brokers. The current rebalancing approach does not consider the existing replica distribution, often resulting in excessive and unnecessary replica movements. These unnecessary movements increase rebalance duration, consume significant bandwidth and CPU resources, and potentially disrupt ongoing production and consumption operations. Thus, a replica rebalancing strategy that minimizes movements while achieving an even distribution of replicas is necessary. **Goals** The proposed approach prioritizes the following objectives: **Minimal Movement**: Minimize the number of replica relocations during rebalancing. **Replica Balancing**: Ensure that replicas are evenly distributed across brokers. **Anti-Affinity Support**: Support rack-aware allocation when enabled. ****Leader Balancing**: Distribute leader replicas evenly across brokers. ISR Order Optimization**: Optimize adjacency relationships to prevent failover traffic concentration in case of broker failures. **Leader Stability**: Where possible, retain existing leader assignments to reduce leadership churn, provided this does not compromise the first five objectives. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org