Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to enable load balancing between replicas #535

Merged
merged 30 commits into from
Apr 22, 2024

Conversation

amerjusupovic
Copy link
Member

@amerjusupovic amerjusupovic commented Mar 18, 2024

Azure/AppConfiguration#868

Adds the following new API to enable load-balancing of requests between replicas for an App Configuration store:

config.AddAzureAppConfiguration(options => {
    // ...
    options.LoadBalancingEnabled = true;
});

Load balancing will always operate on all endpoints available to the provider. If the ReplicaDiscoveryEnabled property is set to true and endpoints have also been passed in explicitly like with AzureAppConfigurationOptions.Connect, then the provider will treat the passed-in endpoints as highest priority for sending requests. It will still load balance between passed-in endpoints and discovered replicas over time.

@amerjusupovic amerjusupovic marked this pull request as ready for review March 21, 2024 00:21
@@ -990,6 +991,27 @@ private void UpdateNextRefreshTime(KeyValueWatcher changeWatcher)
Func<ConfigurationClient, Task<T>> funcToExecute,
CancellationToken cancellationToken = default)
{
if (_options.LoadBalancingEnabled && _lastSuccessfulEndpoint != null)
Copy link
Member

Choose a reason for hiding this comment

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

It seems to also make sense to check if there is more than one client in clients

@jimmyca15
Copy link
Member

Discussed offline, we can revert the last commit since we already depend on repeatable enumeration here.

@amerjusupovic amerjusupovic merged commit e74a679 into preview Apr 22, 2024
2 checks passed
@amerjusupovic amerjusupovic deleted the ajusupovic/load-balancing branch April 22, 2024 19:14
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.

2 participants