Skip to content
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

Move prepareClientToWrite out of loop for HGETALL command #1119

Merged
merged 7 commits into from
Oct 12, 2024

Conversation

imasahiro
Copy link
Contributor

Similar to #860 but this is for HGETALL families (HGETALL/HKEYS/HVALS). This patch moves prepareClientToWrite out of the loop to reduce the function overhead.

  • Test Environment
    • OS: Rocky Linux release 9.4
    • Kernel: 5.14.0-427.22.1.el9_4.x86_64
    • CPU: Intel(R) Xeon(R) Silver 4210
    • Server and Client at different host/vm
  • Test script
# Load generator side
for i in `seq 1 500`; do
    ./valkey-cli -h $H -p $P hset h500 "k$i" "v$i" > /dev/null
done
./valkey-benchmark -h $H -p $P --csv -d 100 -r 1000000 -n 1000000 -c 50 --threads 4 HGETALL h500
$ cat tmp.conf
bind * -::*
daemonize no
protected-mode no
save ""

./src/valkey-server ./tmp.conf
test unstable(150c197) rpc this patch (rpc) improvements
HGETALL h1 85084.66 86926.29 2.16446772
HGETALL h10 78400.62 76893.5 -1.922331737
HGETALL h25 64487.01 58802.77 -8.814550403
HGETALL h50 47587.32 49360.78 3.726749058
HGETALL h100 33028.37 34454.25 4.317137055
HGETALL h300 14628.22 15540.98 6.239720212
HGETALL h500 9593.52 10395.44 8.358975642

Similar to valkey-io#860 but this is for HGETALL families (HGETALL/HKEYS/HVALS).
This patch moves `prepareClientToWrite` out of the loop to reduce
the function overhead.

| test          | unstable(150c197) rpc | this patch (rpc) | improvements |
| ------------- | -------------------------- | ---------------- | ------------ |
| HGETALL h1    | 85084.66                   | 86926.29         |  2.16446772  |
| HGETALL h10   | 78400.62                   | 76893.5          | -1.922331737 |
| HGETALL h25   | 64487.01                   | 58802.77         | -8.814550403 |
| HGETALL h50   | 47587.32                   | 49360.78         |  3.726749058 |
| HGETALL h100  | 33028.37                   | 34454.25         |  4.317137055 |
| HGETALL h300  | 14628.22                   | 15540.98         |  6.239720212 |
| HGETALL h500  | 9593.52                    | 10395.44         |  8.358975642 |

Signed-off-by: Masahiro Ide <[email protected]>
Copy link

codecov bot commented Oct 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.50%. Comparing base (b5eb793) to head (533f4a0).
Report is 9 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1119      +/-   ##
============================================
- Coverage     70.60%   70.50%   -0.11%     
============================================
  Files           114      114              
  Lines         61717    61734      +17     
============================================
- Hits          43578    43526      -52     
- Misses        18139    18208      +69     
Files with missing lines Coverage Δ
src/networking.c 88.07% <100.00%> (-0.37%) ⬇️
src/server.h 100.00% <ø> (ø)
src/t_hash.c 95.88% <100.00%> (+0.03%) ⬆️

... and 14 files with indirect coverage changes

src/t_hash.c Show resolved Hide resolved
Masahiro Ide and others added 2 commits October 5, 2024 11:00
src/networking.c Outdated Show resolved Hide resolved
imasahiro and others added 4 commits October 8, 2024 09:21
Co-authored-by: Madelyn Olson <[email protected]>
Signed-off-by: Masahiro Ide <[email protected]>
Signed-off-by: Masahiro Ide <[email protected]>
Signed-off-by: Masahiro Ide <[email protected]>
@madolson madolson added release-notes This issue should get a line item in the release notes performance labels Oct 11, 2024
@madolson madolson merged commit 262d970 into valkey-io:unstable Oct 12, 2024
47 checks passed
@imasahiro imasahiro deleted the prepareClient branch October 12, 2024 05:00
eifrah-aws pushed a commit to eifrah-aws/valkey that referenced this pull request Oct 20, 2024
…1119)

Similar to valkey-io#860 but this is for HGETALL families (HGETALL/HKEYS/HVALS).
This patch moves `prepareClientToWrite` out of the loop to reduce the
function overhead.

Signed-off-by: Masahiro Ide <[email protected]>
Co-authored-by: Madelyn Olson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance release-notes This issue should get a line item in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants