Skip to content

[tonic-xds] Add the loadbalancer tower service#2607

Merged
gu0keno0 merged 9 commits into
grpc:masterfrom
gu0keno0:lblayer2
Apr 29, 2026
Merged

[tonic-xds] Add the loadbalancer tower service#2607
gu0keno0 merged 9 commits into
grpc:masterfrom
gu0keno0:lblayer2

Conversation

@gu0keno0

@gu0keno0 gu0keno0 commented Apr 28, 2026

Copy link
Copy Markdown
Contributor

Add load balancer tower service that's extensive to support outlier detection and customized channel pickers.

Issue: #2444

Motivation

tonic-xds currently uses tower::balance, which is hard-coded to using P2C LB algorithm. For xDS, we need more flexibility and need full control over the underlying channels so that we can implement customized LB, outlier detection, etc.

Solution

Leverage the channel states (Idle, Connecting and Ready for now), build a new LoadBalance tower service whose poll_ready() handles channel state transitions and call() handles load balance picking algorithm.

Also, added a simple ChannelPicker trait to abstract channel picking algorithm. In the future, customized LB can implement this trait and tonic-xds will provide a way to register customized LB and make it available for LoadBalance layer.

@gu0keno0 gu0keno0 marked this pull request as ready for review April 28, 2026 00:22
@gu0keno0 gu0keno0 requested review from YutaoMa and ankurmittal April 28, 2026 00:22
Comment thread tonic-xds/src/client/loadbalance/pickers/mod.rs Outdated

@LYZJU2019 LYZJU2019 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve from my side

@gu0keno0 gu0keno0 merged commit 538047b into grpc:master Apr 29, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants