Skip to content

read_from_replicas=True Still Sends Requests to Master Nodes in RedisCluster #3552

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

Closed
akshitsaini1 opened this issue Mar 11, 2025 · 3 comments
Assignees

Comments

@akshitsaini1
Copy link

We are using RedisCluster with read_from_replicas=True to offload read operations from the master nodes to replicas. However, we have observed that even with this setting enabled, RedisCluster is still sending some read requests to master nodes instead of strictly using replicas.

Upon checking the source code, we found that the LoadBalancer class is responsible for distributing the requests across both master and replica nodes. This behavior is unexpected as the expectation with read_from_replicas=True is that all read operations should strictly go to the replicas.

Impact on Our Setup

  1. We handle heavy read/write operations with 100Cr+ (10 billion) reads and writes daily.
  2. This issue increases load on master nodes, affecting both write and read latencies.
  3. Replicas are not being fully utilized as expected.

Expected Behavior
When read_from_replicas=True is set, all read requests should only go to replica nodes, and master nodes should be used strictly for write operations.

Observed Behavior
Reads are distributed between both master and replica nodes, likely due to how the LoadBalancer class assigns nodes.

This issue affects high-scale production workloads where strict read/write separation is necessary for performance optimization.

@vladvildanov
Copy link
Collaborator

@akshitsaini1 Hey, thanks for reaching us out! I agree that this naming is misleading, I would say we need to support different strategies, current strategy is more like a round-robin and we need read from replicas only. We would start work on this soon.

@vladvildanov vladvildanov self-assigned this Mar 12, 2025
@akshitsaini1
Copy link
Author

Hello @vladvildanov

Thank you for the quick response! I appreciate the clarification regarding the current strategy. That makes sense.

Could you please share if there’s a planned version where this change might be introduced? This would help us plan accordingly on our end. Looking forward to the update!

@petyaslavova
Copy link
Collaborator

Fixed with PR #3563.
The fix doesn't change the exposed property meaning or effect, but 'read_from_replicas' is now deprecated.
With this PR, we are introducing another property allowing the user to select which concrete load-balancing strategy should be used.

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

No branches or pull requests

3 participants