-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Read from random slave preferred #676
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
Conversation
|
Thanks for your pull request. Workload distribution depends on three factors when looking at slave/slave-preferred mechanisms:
In general, there is a primary decision, whether the actual node list should be sorted or random in general. It looks to me as this should be the bit where we look into as we could:
WDYT? |
|
Sorry for my slow response. Ideally, I would prefer a random list as this will ensure equal traffic between each read node. |
|
I'm fine with keeping
There are no common configuration bits between Redis Cluster and Master/Slave right now and I'd like to keep Master/Slave fairly simple, without additional configuration options. Therefore, I'd introduce system properties that allow configuration without introducing config API in the first place. |
Lettuce now allows to adjust how Redis Cluster and Master/Slave implementations sort their node list. The node list is sorted by default by latency to allow ReadFrom.NEAREST mode. By setting a system property, this behavior can be adjusted: -Dio.lettuce.core.topology.sort=BY_LATENCY (default) -Dio.lettuce.core.topology.sort=NONE (leave nodes as they were reported by Redis) -Dio.lettuce.core.topology.sort=RANDOMIZE (shuffle nodes)
Lettuce now allows to adjust how Redis Cluster and Master/Slave implementations sort their node list. The node list is sorted by default by latency to allow ReadFrom.NEAREST mode. By setting a system property, this behavior can be adjusted: -Dio.lettuce.core.topology.sort=BY_LATENCY (default) -Dio.lettuce.core.topology.sort=NONE (leave nodes as they were reported by Redis) -Dio.lettuce.core.topology.sort=RANDOMIZE (shuffle nodes)
|
I added configuration options via System properties to Lettuce 4.5 and 5.1: Closed via 2138dc6 and 90103db, snapshot builds are available via OSS Sonatype. |
|
For people stumbling here from google search (like me 2 weeks ago), please do check: https://aws.amazon.com/about-aws/whats-new/2019/06/amazon-elasticache-launches-reader-endpoint-for-redis/ for balancing load among read replicas. this was recently introduced by AWS (June 19) |
I would like to be able to load balance read replicas to avoid overwhelming a particularly fast replica. With the ReadFromSlavePreferred class, I found that one or two nodes would end up taking the vast majority of the traffic whilst other nodes are doing very little work.