Skip to content

Fixing Load Balancing shuffle#48274

Open
mrm9084 wants to merge 2 commits intoAzure:mainfrom
mrm9084:LoadBalanceShuffle
Open

Fixing Load Balancing shuffle#48274
mrm9084 wants to merge 2 commits intoAzure:mainfrom
mrm9084:LoadBalanceShuffle

Conversation

@mrm9084
Copy link
Member

@mrm9084 mrm9084 commented Mar 5, 2026

Description

More load balancing fixes:

  • If the customer provides more than one endpoint manually, we shuffle them before using them the first time.
  • findActiveClients use to do a lot of unneeded work to recreate the active clients list every time it was called, now load balancing only creates it when we finish a loop through the client list. We also make sure when load balancing is disabled we always reload the list as we want to use the clients in priority order.

Added some tests

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • [] CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings March 5, 2026 19:31
@github-actions github-actions bot added the azure-spring All azure-spring related issues label Mar 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

@mrm9084 mrm9084 requested a review from nroutray as a code owner March 6, 2026 17:47
Copy link
Member

Choose a reason for hiding this comment

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

Why not just use:

if ( (activeClients.size() == 0 && configStore.isLoadBalancingEnabled()) || !configStore.isLoadBalancingEnabled()) {

  activeClients = getAvailableClients();

}

Copy link
Member Author

Choose a reason for hiding this comment

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

I think when I started to write it I thought there would be other paths through, but just ended up with this. I'll clean it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

azure-spring All azure-spring related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants