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

Backport: Optimize RDB load performance and fix cluster mode resizing on replica side (#1199) #1328

Open
wants to merge 1 commit into
base: 8.0
Choose a base branch
from

Conversation

naglera
Copy link
Contributor

@naglera naglera commented Nov 20, 2024

This PR addresses two issues:

  1. Performance Degradation Fix - Resolves a significant performance issue during RDB load on replica nodes.
  • The problem was causing replicas to rehash multiple times during the load process. Local testing demonstrated up to 50% degradation in BGSAVE time.
  • The problem occurs when the replica tries to expand pre-created slot dictionaries. This operation fails quietly, resulting in undetected performance issues.
  • This fix aims to optimize the RDB load process and restore expected performance levels.
  1. Bug fix when reading RDB_OPCODE_RESIZEDB in Valkey 8.0 cluster mode-
  • Use the shard's master slots count when processing this opcode, as clusterNodeCoversSlot is not initialized for the currently syncing replica.
  • Previously, this problem went unnoticed because RDB_OPCODE_RESIZEDB had no practical impact (due to 1).

These improvements will enhance overall system performance and ensure smoother upgrades to Valkey 8.0 in the future.

Testing:

  • Conducted local tests to verify the performance improvement during RDB load.
  • Verified that ignoring RDB_OPCODE_RESIZEDB does not negatively impact functionality in the current version.

(cherry picked from commit c5012cc)

…a side (valkey-io#1199)

This PR addresses two issues:

1. Performance Degradation Fix - Resolves a significant performance
issue during RDB load on replica nodes.
- The problem was causing replicas to rehash multiple times during the
load process. Local testing demonstrated up to 50% degradation in BGSAVE
time.
- The problem occurs when the replica tries to expand pre-created slot
dictionaries. This operation fails quietly, resulting in undetected
performance issues.
- This fix aims to optimize the RDB load process and restore expected
performance levels.

2. Bug fix when reading `RDB_OPCODE_RESIZEDB` in Valkey 8.0 cluster
mode-
- Use the shard's master slots count when processing this opcode, as
`clusterNodeCoversSlot` is not initialized for the currently syncing
replica.
- Previously, this problem went unnoticed because `RDB_OPCODE_RESIZEDB`
had no practical impact (due to 1).

These improvements will enhance overall system performance and ensure
smoother upgrades to Valkey 8.0 in the future.

Testing:
- Conducted local tests to verify the performance improvement during RDB
load.
- Verified that ignoring `RDB_OPCODE_RESIZEDB` does not negatively
impact functionality in the current version.

Signed-off-by: naglera <[email protected]>
Co-authored-by: Binbin <[email protected]>
(cherry picked from commit c5012cc)
Signed-off-by: naglera <[email protected]>
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 70.62%. Comparing base (4fbab57) to head (bb40d19).

Files with missing lines Patch % Lines
src/db.c 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              8.0    #1328      +/-   ##
==========================================
- Coverage   70.66%   70.62%   -0.04%     
==========================================
  Files         114      114              
  Lines       61681    62951    +1270     
==========================================
+ Hits        43585    44458     +873     
- Misses      18096    18493     +397     
Files with missing lines Coverage Δ
src/kvstore.c 96.27% <100.00%> (+0.13%) ⬆️
src/db.c 88.50% <0.00%> (+0.08%) ⬆️

... and 90 files with indirect coverage changes

---- 🚨 Try these New Features:

@xbasel xbasel self-requested a review November 20, 2024 18:05
@zuiderkwast zuiderkwast changed the title Optimize RDB load performance and fix cluster mode resizing on replica side (#1199) Backport: Optimize RDB load performance and fix cluster mode resizing on replica side (#1199) Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants