-
Notifications
You must be signed in to change notification settings - Fork 47
[draft] unhealthy node handling #56
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
Draft
srikar-jilugu
wants to merge
3
commits into
valkey-io:main
Choose a base branch
from
srikar-jilugu:healthyfix
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+121
−12
Draft
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
Hi @srikar-jilugu, thanks for the PR. I think the idea is good. A few thoughts:
conns[nodeInfo.Addr]assignments is not the correct place to exclude unhealthy connections in this refresh cycle. The actual places to skip those connections are the assignments ofpslots[i]andrslots[i].valkey-go/cluster.go
Line 255 in ed9f107
valkey-go/cluster.go
Line 284 in ed9f107
SetServerUnHealthymethod. It should be done privately in theconn.UnHealthyNodeIntervaloption, and 15s is too long. I guess we need a periodic active check.IsLoadingcould be better thanIsServerUnHealthy.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.
1,2: I believe, this change would only check the health status for the replica nodes, as we are initiating
connrolefor master seperately here.valkey-go/cluster.go
Line 213 in ed9f107
Also in the case when there is only one replica and it is unhealthy, we are falling back to master while assigning connections to
pslotsandrslots. So this shouldn't cause a situation where we are out of conn assignments or ignore a master node for assignment.3: Any suggestion on how we can detect that the node is unhealthy, I think, this method would allow us to extend it to other scenarios (for eg: setting it to unhealthy, when multiple retries are failing) as well in future.
4. Agreed, this need not be exposed
5. As mentioned in the point 3, I think we can use this status in some other cases in future and not just loading. wdyt?
Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, but we still have a final mutation for the
connmap at L236-L245. Please do the unhealthy check after that:valkey-go/cluster.go
Lines 236 to 245 in ed9f107
There are two ways to check if a node is loading: check the
loading_eta_secondsin anINFOresponse, or check each response if a loading error occurs. I don't have a good idea for detecting other unhealthy scenarios. I guess whether a node is unhealthy or not even varies from user to user. Different users may want different behaviors. Could we just useIsLoadingfor now to avoid overloading the termUnhealthyuntil we come up with an API that allows users to mark a node as unhealthy and specify what to do with it?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.
@rueian updated the load status handling based on your feedback, roughly
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.
will test this out on our workloads as well, before I make this PR open