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
Made the router skip health checks when there is one endpoint #16643
Made the router skip health checks when there is one endpoint #16643
Conversation
@openshift/networking @openshift/sig-networking PTAL |
pkg/router/template/plugin.go
Outdated
// Count the number of endpoint addresses (we have to do this first since we need the result when we loop below) | ||
// But the two loop conditions must be the same | ||
numEndpoints := 0 | ||
for _, s := range subsets { |
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.
Run this loop only if wasIdled=false. Just to be more efficient.
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.
Or rather run a loop in the end on the 'out' array only if wasIdled=false and len(out)==1 and fix all elements of the 'out' array to set NoHealthCheck=true. This way we would only loop if the length is 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.
Fair enough... but I'm also considering adding metrics to the router for:
- Num idled
- Num endpoints
- Num health checked endpoints
And so on... so may need to flip this back. However, until we do that, I'll go for the faster version.
pkg/router/template/plugin.go
Outdated
|
||
// TODO: review me for sanity | ||
// Now build the actual endpoints we pass to the template | ||
out := make([]Endpoint, 0, numEndpoints) |
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 would just do this and if there is more than 1 end point (after line 325), loop over endpoints setting the flag. The argument to do this suggests that most of the time the count will be 1. Looping to find that out seems inefficient.
If there is only one endpoint for a route, there is no point to doing health checks. If the endpoint is down, haproxy will fail to connect. Skipping the checks helps tremendously on servers with large numbers of routes, because reducing any checking means the router doesn't spend a lot of time doing health checks pointlessly. Fixes bug 1492189 (https://bugzilla.redhat.com/show_bug.cgi?id=1492189)
e200b1b
to
4833eb5
Compare
/test |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: knobunc, pecameron The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
Automatic merge from submit-queue (batch tested with PRs 16545, 16684, 16643, 16459, 16682). |
If there is only one endpoint for a route, there is no point to doing
health checks. If the endpoint is down, haproxy will fail to connect.
Skipping the checks helps tremendously on servers with large numbers
of routes, because reducing any checking means the router doesn't
spend a lot of time doing health checks pointlessly.
Fixes bug 1492189 (https://bugzilla.redhat.com/show_bug.cgi?id=1492189)