Skip to content

Fix valkey-benchmark FUNCTION LOAD write to replicas (#1846)#3376

Open
hieu2102 wants to merge 5 commits intovalkey-io:unstablefrom
hieu2102:fix-valkey-benchmark-function-load-write-to-replica
Open

Fix valkey-benchmark FUNCTION LOAD write to replicas (#1846)#3376
hieu2102 wants to merge 5 commits intovalkey-io:unstablefrom
hieu2102:fix-valkey-benchmark-function-load-write-to-replica

Conversation

@hieu2102
Copy link
Contributor

@hieu2102 hieu2102 commented Mar 18, 2026

fix #1846

  • add field primary_nodes and primary_nodes_count to config
  • if config.title == "function_load", then the benchmarking clients will connect to a node from config.primary_nodes instead of config.cluster_nodes
  • fix FCALL getting MOVED $slot error by adding tag to the FCALL command

@codecov
Copy link

codecov bot commented Mar 18, 2026

Codecov Report

❌ Patch coverage is 91.30435% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.70%. Comparing base (ac5e44c) to head (93c0bdc).
⚠️ Report is 3 commits behind head on unstable.

Files with missing lines Patch % Lines
src/valkey-benchmark.c 91.30% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #3376      +/-   ##
============================================
+ Coverage     74.53%   74.70%   +0.17%     
============================================
  Files           130      130              
  Lines         72731    72741      +10     
============================================
+ Hits          54208    54344     +136     
+ Misses        18523    18397     -126     
Files with missing lines Coverage Δ
src/valkey-benchmark.c 72.59% <91.30%> (+11.08%) ⬆️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: hieu2102 <[email protected]>
@hieu2102
Copy link
Contributor Author

For the tests, I check if valkey-benchmark error code != 0, since we can't check for precise calls count if the command got redirected

@zuiderkwast
Copy link
Contributor

What about write commands like SET, do they get sent to replicas too?

@hieu2102
Copy link
Contributor Author

@zuiderkwast I did write a test for SET, GET too. They did get sent to replicas, but will be MOVED to the correct primary.
In FUNCTION LOAD case, it failed because the error is Cannot write to replica instead of MOVED

@zuiderkwast
Copy link
Contributor

I did write a test for SET, GET too. They did get sent to replicas, but will be MOVED to the correct primary.

OK, so it appears to work for SET, but it's not very realistic to benchmark SET with redirects for each command, is it?

A more intuitive behavior for read-from-replicas would be that only read commands get sent to replicas. Write commands (if any) still get sent to the primaries.

Seems like #1392 didn't discuss write commands at all.

Another (easier) approach is to just document that --rfr should only be used with read commands. If it's used with write commands, the behavior is undefined. Something like that.

@ranshid WDYT?

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

Successfully merging this pull request may close these issues.

[BUG] valkey-benchmark fires write request ( FUNCTION LOAD ) to replicas when using --rfr all or --rfr yes option

3 participants