-
Notifications
You must be signed in to change notification settings - Fork 955
Support for reading from replicas in valkey-benchmark #1392
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
Conversation
e4e100b to
3882216
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1392 +/- ##
============================================
- Coverage 70.83% 70.82% -0.01%
============================================
Files 118 119 +1
Lines 63549 64689 +1140
============================================
+ Hits 45013 45818 +805
- Misses 18536 18871 +335
|
|
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? @madolson |
|
@ranshid Can you take a look? |
ranshid
left a comment
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 |
Refactoring with enum, readFromReplicas, and combining two options(rfa, rfro) int single option(rfr) Signed-off-by: bluayer <[email protected]>
916cd5a to
e1e925f
Compare
ranshid
left a comment
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.
Just started to play with the benchmark before approving and I noticed some issues
1. Modify mode option, "replicas" and "all" only 2. Allocate replicate name in replica node and determine whether it is a primary or a replica based on the presence of "replicate" 3. Adjust position of continue statement for --rfr only case 4. Change the i plus timing at option Signed-off-by: bluayer <[email protected]>
5340691 to
570f5f6
Compare
Signed-off-by: bluayer <[email protected]>
ranshid
left a comment
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.
some minor suggestions
Signed-off-by: bluayer <[email protected]>
Based on @ranshid suggestion Co-authored-by: ranshid <[email protected]> Signed-off-by: Jungwoo Song <[email protected]>
Co-authored-by: ranshid <[email protected]> Signed-off-by: Jungwoo Song <[email protected]>
Co-authored-by: ranshid <[email protected]> Signed-off-by: Jungwoo Song <[email protected]>
ranshid
left a comment
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.
LGTM
Signed-off-by: bluayer <[email protected]>
|
@bluayer all looks good IMO. Thank you for taking the time to introduce and refactor! |
|
Hello, @madolson ! |
**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 : valkey-io#900 **Changes** 1. Replaced the use of `CLUSTER NODES` with `CLUSTER SLOTS` when fetching cluster configuration. This allows for easier identification of replica slots. 2. Support for reading from replicas by executing the client in `READONLY` mode. 3. Support reading from replicas even during slot migrations. 4. Introduced two CLI options `--rfr` to enable reading from replicas only or all cluster nodes. A warning added to indicate that write requests might not be handled correctly when using this option. --------- Signed-off-by: bluayer <[email protected]> Signed-off-by: bluayer <[email protected]> Signed-off-by: Jungwoo Song <[email protected]> Co-authored-by: ranshid <[email protected]>
## Summary Add description about '--rfr', read from replicas ## From release notes At 8.1.0-rc1 -> valkey-io/valkey#1392 --------- Signed-off-by: Jungwoo Song <[email protected]> Co-authored-by: Ran Shidlansik <[email protected]>
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 NODESwithCLUSTER SLOTSwhen fetching cluster configuration. This allows for easier identification of replica slots.READONLYmode.--rfrto enable reading from replicas only or all cluster nodes. A warning added to indicate that write requests might not be handled correctly when using this option.