-
Notifications
You must be signed in to change notification settings - Fork 596
deployer: Optimize default gateway probe timings #12784
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
base: main
Are you sure you want to change the base?
Conversation
This change reduces the startup probe failure threshold from 60 to 30, decreases the readiness probe period from 10s to 5s, and adds explicit timeout (1s) and failure threshold (3) values to the readiness probe. Open question on whether setting InitialDelaySeconds to 0 for the readiness probe is better or worse than giving a second or two buffer once the startup probe finishes in the case there's a large xDS push or some other edge case. These optimizations help improve pod startup time from up to 60s to a maximum of 30s, resulting in faster gateway deployments, especially when running the conformance suite locally. Signed-off-by: timflannagan <[email protected]>
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.
Pull Request Overview
This PR adjusts Kubernetes probe timing configurations to reduce startup and readiness detection times. The changes optimize the health check parameters for faster pod initialization and service availability detection.
- Readiness probe checks more frequently (5s vs 10s period) with explicit timeout and failure thresholds
- Startup probe failure threshold reduced from 60 to 30, cutting maximum startup time in half (from 60s to 30s)
- Test helper functions updated to match the new probe configurations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/deployer/gateway_parameters.go | Updates default readiness and startup probe parameters with more aggressive timing |
| pkg/deployer/deployer_test.go | Updates test probe generation functions to reflect the new default values |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
My understanding, at least in Istio-envoy and Kgw-Agentgateway, is once the probe returns true its going to always be true after that (unless it times out I guess). So if the startup probe finished, the readiness probe is ~guaranteed to succeed with 0s buffer |
| InitialDelaySeconds: 0, | ||
| PeriodSeconds: 10, | ||
| PeriodSeconds: 5, | ||
| TimeoutSeconds: 1, |
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.
fwiw I have seen envoy take more than 1s at load due to prometheus scrapes or large XDS pushes locking up the main thread.
But with failureThreshold 3 that is probably mitigated
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 originally had this set to 2 before deciding to have an agent double check these values. Down to add a second buffer here
| PeriodSeconds: 1, | ||
| TimeoutSeconds: 2, | ||
| FailureThreshold: 60, | ||
| FailureThreshold: 30, |
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.
IMO, the startup, liveness, and readiness probes are should be optimized by 'least likely to cause an outage' and 'has lowest expected value of outage duration'. This leads to a few guidelines:
- use a startupProbe
- be cautious to startup -- really make sure you're started
- be cautious to stop serving traffic (to fail readiness)
- be cautious to beg k8s to restart your pod (to fail liveness)
- be gentle on the started, ready, serving pod -- do not use expensive checks
- only do checks that succeed in extremely highly loaded cases. e.g., an HTTP probe against a go server with GOMAXPROCS=1 is not uncommon in production scenarios, so make sure that an HTTP readiness/liveness probe does not rot in a queue
For these reasons, it's much better, once you've passed startupProbe, to use tcpSocket than to use an HTTP request.
Can we/should we wait on initial xDS updates to finish before passing startupProbe?
Why would you decrease how long startupProbe waits? In an outage, you badly want a new pod to come up.
Why not make periodSeconds for readiness and liveness '1'?
If /ready never fails after it succeeds, tcpSocket sounds good and we may not need both liveness and readiness.
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.
Envoy is in C++, not go, so my GOMAXPROCS comment is wrong but illustrative -- do not expect a highly loaded Envoy (such as what would result if you, e.g., lost several k8s nodes unexpectedly) to keep responding to /ready with the same latency as before. If you must use HTTP probes for liveness or readiness, give them generous timeouts to avoid removing servers and cascading from high latency to a 100% outage.
Description
This change reduces the startup probe failure threshold from 60 to 30, decreases the readiness probe period from 10s to 5s, and adds explicit timeout (1s) and failure threshold (3) values to the readiness probe.
Open question on whether setting InitialDelaySeconds to 0 for the readiness probe is better or worse than giving a second or two buffer once the startup probe finishes in the case there's a large xDS push or some other edge case.
These optimizations help improve pod startup time from up to 60s to a maximum of 30s, resulting in faster gateway deployments, especially when running the conformance suite locally.
Users can still tune these probe values with an explicit GWP attached to the relevant class || GW.
Change Type
/kind cleanup
Changelog
Additional Notes