[CAE-1046] fix(loading): cache the loaded flag for slave nodes#3410
Merged
[CAE-1046] fix(loading): cache the loaded flag for slave nodes#3410
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Adds a caching mechanism to skip repeated loading checks for slave nodes once they’re determined to be “loaded.”
- Introduces an atomic
loadedflag toclusterNode - Resets
loadedwhen a node is marked as failing - Updates
Loading()to short-circuit and setloadedafter the first non-loading result
Comments suppressed due to low confidence (1)
osscluster.go:343
- [nitpick] The field name
loadedis a bit ambiguous. Consider renaming it to something likeisLoadCompleteorloadCachedto clarify that it’s a one-time cache flag.
loaded uint32 // atomic
867a693 to
49c07d1
Compare
LINKIWI
reviewed
Jun 17, 2025
Contributor
LINKIWI
left a comment
There was a problem hiding this comment.
Thanks! I agree this should resolve the latency regression introduced in v9.9.0 for the typical case slave request.
Ideally (in the future) we can update the loading state as a side effect of user command execution, in order to obviate the need for an explicit additional critical-path PING.
ofekshenawa
approved these changes
Jun 18, 2025
ofekshenawa
pushed a commit
to ofekshenawa/go-redis
that referenced
this pull request
Jun 30, 2025
…#3410) * fix(loading): cache the loaded flag for slave nodes * fix(lint): make linter happy
ofekshenawa
pushed a commit
that referenced
this pull request
Aug 10, 2025
* fix(loading): cache the loaded flag for slave nodes * fix(lint): make linter happy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checking the loading state by sending a ping on each node selections increases the latency. See comments in #3370 .
This introduces a naive cache that should improve the latency once the node is marked as
loaded