-
Notifications
You must be signed in to change notification settings - Fork 180
Consolidate ha config into a single enableLeaderElection, also fix rolling update stuck bug #1620
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
Conversation
✅ Deploy Preview for gateway-api-inference-extension ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
…lling update stuck bug
@@ -1,5 +1,5 @@ | |||
inferenceExtension: | |||
replicas: 1 | |||
enableLeaderElection: false |
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.
Wondering if we actually want to make the default true
since this is the only path to HA while maintaining prefix-cache perf
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.
Trying to respect current default as this is a patch to a release, but I would be open to that as the best practice
{{- include "gateway-api-inference-extension.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.inferenceExtension.replicas | default 1 }} | ||
{{- if .Values.inferenceExtension.enableLeaderElection }} |
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.
Is there a way to articulate this where the default is 3 if leaderElection is enabled, and the default is 1 otherwise?
This would still allow a user to specify replica count if desired.
We currently suggest active-passive as a best HA practice, but a user could decide they would rather use active-active, incur the performance cost(or maybe their algo works fine with active-active), and use multiple replicas
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.
It's a tradeoff between simplicity and best practice vs the flexibility I had to make. I think in helm we should prioritize the former, as advanced users can always fork and tweak for the additional flexibility they want.
So for the current best practices, I think we recommend HA with 3 replicas for "critical" use cases, and 1 replica for non-critical. We don't recommend active-active due to routing performance reasons. Users can do that if they understand the details, but we don't offer that out of the box in helm. My worry is that if we offer that, they will find the performance worse than what we advertise, and it's not obvious why that happens.
Open for debate but I think simplicity is quite important here. In the current state it's easy to shoot yourself in the foot with multiple active-active replicas without understanding the performance penalty, and meanwhile it's hard to configure the leader election properly as there are 3 things going on (the flag, the replicas, and the rbac).
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.
Perhaps we just need to add some more documentation, and explain that if you want to go active-active, you can tweak this way, and here are the implications, bla bla.
Is this an acceptable outcome? I do think that users who want active-active need to understand the implications, and likely "advanced" use cases. We don't need to make it simple, but we need to articulate 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.
I think 3 is a reasonable default that I don't think many would want to change.
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.
this change makes the replicas field not overridable, but hardcoded.
In the current state it's easy to shoot yourself in the foot with multiple active-active replicas without understanding the performance penalty
I agree with the above, therefore I suggest keeping replicas always 1 when leader election is disabled,
but can we change it at least in leaderEnabled setup?
it should be possible to override the number of replicas easily.
I'm expecting something like:
{{- if .Values.inferenceExtension.enableLeaderElection }}
replicas: {{ .Values.inferenceExtension.replicas | default 3 }}
{{- else }}
replicas: 1
{{- end }}
so we get default of 3/1 (depends on the HA settings), but can still override the value of replicas as we wish.
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.
alternatively, another proposal -
we can remove the enableLeaderElection
flag completely from helm and use only replicas
field.
then we add if/else to the helm templates -
if replicas is 1 - no leader election
if replicas is more than 1 - leader election enabled.
this way, there is no way for users to get confused in their setup because they set only a single field and we set the leader election for them automatically.
so we change the deployment template as follows:
{{- if gt .Values.inferenceExtension.replicas 1 }}
- --ha-enable-leader-election
I like this proposal more, since it keeps the user away from leader election enabled/disabled and keeps him focused only on the number of replicas.
we currently don't want to support active active mode, and therefore it shouldn't be possible to configure it through our helm chart.
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.
created PR #1628
Regarding the 1st fix: "Adjusted the gke health check and EPP readiness check to every 2s instead of 5s, this allows faster switch over to the new EPP leader (in my tests this goes from 10-15s to less than 5s)." -- leader-elect-lease-duration duration Default: 15s| The duration that non-leader candidates will wait after observing a leadership renewal until attempting to acquire leadership of a led but unrenewed leader slot. This is effectively the maximum duration that a leader can be stopped before it is replaced by another candidate. This is only applicable if leader election is enabled. --leader-elect-renew-deadline duration Default: 10s| The interval between attempts by the acting master to renew a leadership slot before it stops leading. This must be less than the lease duration. This is only applicable if leader election is enabled. --leader-elect-retry-period duration Default: 2s| The duration the clients should wait between attempting acquisition and renewal of a leadership. This is only applicable if leader election is enabled. |
RE: Health check frequency I did observe with the changes the new leader becomes ready much faster. However I did not test e2e whether the request downtime is actually shorter. These changes are probably beneficial (or at no harm) anyway. |
Cool. Then let's go with the health check frequency change. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ahg-g, liu-cong The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…lling update stuck bug (#1620)
What type of PR is this?
/kind bug
What this PR does / why we need it:
In addition to fix the bug, I did the following improvements:
enableLeaderElection
flag. Previous to enable HA you need to do 3 things: 1. setenableLeaderElection=true
2. setreplicas=3
3. setflags.ha-enable-leader-election=true
. This is hard to get right.Which issue(s) this PR fixes:
Fixes #1619
Does this PR introduce a user-facing change?: