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

Adding load balancing strategy configuration to cluster clients(replacement for 'read_from_replicas' config) #3563

Merged
merged 5 commits into from
Mar 19, 2025

Conversation

petyaslavova
Copy link
Collaborator

Pull Request check-list

Please make sure to review and check all of these items:

  • Do tests and lints pass with this change?
  • Do the CI tests pass with this change (enable it first in your forked repo and wait for the github action build to finish)?
  • Is the new or changed code fully tested?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Is there an example added to the examples folder (if applicable)?
  • Was the change added to CHANGES file?

NOTE: these things are not required to open a PR and can be done
afterwards / while the PR is open.

Description of change

Adding load balancing strategy configuration to cluster clients(replacement for 'read_from_replicas' config)
The idea of this setting is to replace the currently existing 'read_from_replicas' configuration - its name is confusing. It leaves the impression that all the reads will be sent to replica nodes, while it actually chooses between the primary and replicas in a round-robin manner.
There was one specific situation in which random replica selection was also exposed - with this change, this configuration will be exposed through the RedisCluster objects for sync and async clients.

  • Adding a new configuration field for Redis Cluster objects - load_balancing_strategy
  • Adding deprecation for one of the current configs - read_from_replicas
  • Adding a new enum for the available load-balancing strategies (LoadBalancingStrategy)
  • Adding unit tests for the cluster and cluster pipeline operations with the new load-balancing strategies
  • Adding unit test coverage for the added load-balancing strategies
  • Adding some setup fixes for multiptocessing unit tests (the issue resurfaced for Mac users with a recent merge)

@petyaslavova
Copy link
Collaborator Author

Fixes issue #3552

@vladvildanov vladvildanov added breakingchange API or Breaking Change and removed breakingchange API or Breaking Change labels Mar 18, 2025
@petyaslavova petyaslavova force-pushed the ps_enhance_load_balancing_api branch from 26aa5da to f8ee18e Compare March 18, 2025 17:02
@petyaslavova petyaslavova merged commit 7a36e8b into master Mar 19, 2025
37 checks passed
@petyaslavova petyaslavova deleted the ps_enhance_load_balancing_api branch March 19, 2025 07:58
petyaslavova added a commit to rohansingh/redis-py that referenced this pull request Mar 25, 2025
…cement for 'read_from_replicas' config) (redis#3563)

* Adding laod balancing strategy configuration to cluster clients(replacement for 'read_from_replicas' config)

* Fixing linter errors

* Changing the LoadBalancingStrategy type hints to be defined as optional. Fixed wording in pydocs

* Adding integration tests with the different load balancing strategies for read operation

* Fixing linters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants