-
Notifications
You must be signed in to change notification settings - Fork 687
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
Support for reading from replicas in valkey-benchmark #1392
base: unstable
Are you sure you want to change the base?
Conversation
e4e100b
to
3882216
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1392 +/- ##
============================================
+ Coverage 70.83% 70.90% +0.07%
============================================
Files 118 118
Lines 63549 63494 -55
============================================
+ Hits 45013 45021 +8
+ Misses 18536 18473 -63
|
I fully understand that the maintainers of this project are extremely busy and prioritize tasks based on the importance. However, I believe this PR could be a good contribution to this project. If you don't mind, can I ask for a PR review or a reviewer assignment? @zuiderkwast, @madolson |
@ranshid Can you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM. some comments. specifically I did not understand why we are not supporting reading form the primnaries as well
76545cb
to
d1a13ed
Compare
1. The CLUSTER NODES command does not provide replicas' slot range. Therefore, I have changed to use the CLUSTER SLOTS command to implement read from the Replica. 2. If you use the CLUSTER NODES command, the string parsing is so long and complex that it makes the code difficult to read. In comparison, CLUSTER SLOTS makes the code much simpler and more concise. 3. As noted in the TODO comment, the migrating and importing information is not used. Signed-off-by: bluayer <[email protected]> Signed-off-by: bluayer <[email protected]>
1. Add CLI option and description for reading from replicas with cluster option. 2. If the user uses the replicas option, the READONLY command is automatically used when the client is created. Signed-off-by: bluayer <[email protected]> Signed-off-by: bluayer <[email protected]>
1. Update the slot by distinguishing whether it is a primary or a replica. 2. With the above change, the variable name "primaries" has been changed to "nodes". Signed-off-by: bluayer <[email protected]> Signed-off-by: bluayer <[email protected]>
Added a warning about writing requests with replicas option Signed-off-by: bluayer <[email protected]> Signed-off-by: bluayer <[email protected]>
Signed-off-by: bluayer <[email protected]> Signed-off-by: bluayer <[email protected]>
No longer managing attributes about slots migration at the cluster node struct, so remove it. Signed-off-by: bluayer <[email protected]>
The `CLUSTER SLOTS` command returns a node that is responsible for multiple slot ranges multiple times. Therefore, I modify it for creating a node only once using dict, even if there are multiple slot ranges. Signed-off-by: bluayer <[email protected]>
- When users enable rfa(read_from_all) option, they can read from replica and primary. - When users enable rfro(read_from_replicas only) option, they can read from replicas only. - If users don't use any option related to replicas, they can read from primaries only. - Add READONLY when enabling option for reading all nodes Signed-off-by: bluayer <[email protected]>
9de2f81
to
bd44040
Compare
@ranshid Thanks for your review and suggestion. I fixed the lines based on your review and suggestion. Please take a look the changes. |
Thank you @bluayer I will try to take a look today but might not get to it and I will be on vacation till Monday. So sorry in advance if this will delay to next week. |
Thank you @ranshid for telling me that. Of course, I completely understand you because it's the holiday season! Don't worry about being postponed and have a great vacation |
Background
When conducting performance tests using
valkey-benchmark
, reading from replicas was not supported. Consequently, even in cluster mode, all reads were directed to the primary nodes. This limitation made it challenging to obtain accurate metrics during workload stress testing for performance measurement or before a version upgrade.Related issue : #900
Changes
CLUSTER NODES
withCLUSTER SLOTS
when fetching cluster configuration. This allows for easier identification of replica slots.READONLY
mode.--rfa
to enable reading from all cluster nodes and--rfro
to enable reading from replicas only. A warning added to indicate that write requests might not be handled correctly when using this option.