Skip to content

Add initialDelaySeconds=2 to queue-proxy readiness probe - #3869

Closed
tanzeeb wants to merge 1 commit into
knative:masterfrom
tanzeeb:queue-proxy-readiness-initial-delay
Closed

tanzeeb wants to merge 1 commit into
knative:masterfrom
tanzeeb:queue-proxy-readiness-initial-delay

Conversation

@tanzeeb

@tanzeeb tanzeeb commented Apr 23, 2019 •

Copy link
Copy Markdown
Contributor

Fixes #3308

There's a race between the queue-proxy health check handler and the readiness probe. We get falsely alarming warnings like this in the k8s event log:

Readiness probe failed: Get http://10.36.0.97:8022/health: dial tcp 10.36.0.97:8022: connect: connection refused

This change gives the queue-proxy a few seconds to get started.

Proposed Changes

  • Add initialDelaySeconds = 2 to the queue-proxy readiness probe

Release Note

NONE

Update: Fix incorrect root cause, thanks @markusthoemmes

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 23, 2019
@knative-prow-robot knative-prow-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 23, 2019

@knative-prow-robot knative-prow-robot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanzeeb: 0 warnings.

Details

In response to this:

Fixes #3308

There's a race between the user-container binding to the port, and the queue-proxy reporting successful connection to that port. We get falsely alarming warnings like this in the k8s event log:

Readiness probe failed: Get http://10.36.0.97:8022/health: dial tcp 10.36.0.97:8022: connect: connection refused

This change gives the user-container a few seconds to get started.

Proposed Changes

  • Add initialDelaySeconds = 2 to the queue-proxy readiness probe

Release Note

NONE

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the area/API API objects and controllers label Apr 23, 2019
@knative-prow-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tanzeeb
To fully approve this pull request, please assign additional approvers.
We suggest the following additional approver: dgerd

If they are not already assigned, you can assign the PR to them by writing /assign @dgerd in a comment when ready.

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@markusthoemmes markusthoemmes left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This effectively sets the lower bound for any cold-start latency to at least 2 seconds. I don't think we want that?

The queue-proxy should retry its probing to the user-container anyway. So really, are you seeing the readiness probe to the queue-proxy itself failing?

@tanzeeb

tanzeeb commented Apr 23, 2019 •

Copy link
Copy Markdown
Contributor Author

The queue-proxy should retry its probing to the user-container anyway. So really, are you seeing the readiness probe to the queue-proxy itself failing?

Ah, I think you're right... this has nothing to do with the user-container, just the queue-proxy itself.

I can fix the messaging of the PR, but bigger question: is the issue even worth fixing?

This effectively sets the lower bound for any cold-start latency to at least 2 seconds. I don't think we want that?

It does introduce a cold-start latency. I've tried with initialDelaySeconds=1 but the warnings are quite reproducible. Maybe we live with the warnings for the sake of minimizing cold-start latency?

Fixes knative#3308

There's a race between the `queue-proxy` health check handler and the
readiness probe. We get falsely alarming warnings like this in the k8s event log:

```
Readiness probe failed: Get http://10.36.0.97:8022/health: dial tcp 10.36.0.97:8022: connect: connection refused
```

This change gives the `queue-proxy` a few seconds to get started.
@tanzeeb
tanzeeb force-pushed the queue-proxy-readiness-initial-delay branch from 1db4885 to d95d8f0 Compare April 23, 2019 17:06
@knative-metrics-robot

Copy link
Copy Markdown

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/reconciler/revision/resources/queue.go Do not exist 100.0%

@dgerd

dgerd commented Apr 23, 2019

Copy link
Copy Markdown

As a temporary solution, I would rather update the failureThreshold than update the initialDelaySeconds for the cold-start reasons given by Markus.

However, it is a bit suspicious that the queue proxy takes up to 2 seconds (and frequently more than 1 second) from container startup to a healthy queue-proxy.

@tcnghia

tcnghia commented Apr 23, 2019

Copy link
Copy Markdown
Contributor

My guess in this case is that the istio-proxy isn't up and as a result nothing listens on port :8022. it would be easy to confirm this by either changing the probe to Exec to run curl or turn off sidecar injection to see if the same probe failures are still there.

@tanzeeb

tanzeeb commented Apr 23, 2019 •

Copy link
Copy Markdown
Contributor Author

I would rather update the failureThreshold than update the initialDelaySeconds

confirm this by either changing the probe to Exec to run curl or turn off sidecar injection to see if the same probe failures are still there.

Great ideas, I'll take a look

/hold

@tanzeeb

tanzeeb commented Apr 24, 2019

Copy link
Copy Markdown
Contributor Author

@dgerd I just tried failureThreshold: 30 (default is 3), but the warnings don't go away. I suspect that the warning is thrown after each failure.

@dgerd

dgerd commented Apr 24, 2019

Copy link
Copy Markdown

@tanzeeb

Correct. I don't expect the warning to go away, but I expect the container to not fail prematurely. If we are reliably hitting 1-2 failure messages before the container starts it means we are only 1 away from killing the container which would result in a failed Revision creation. Increasing the failureThreshold would simply increase our buffer before failure in the cases where we take slightly longer to come up.

Increasing the initialDelaySeconds to 2 and keeping the failureThreshold at 3 would fail at the same time as keeping the initialDelaySeconds at 0 and increasing the failureThreshold to 5. So they should behave the same from a startup failure perspective, but will not be subject to a 2 second cold-start floor.

That said, I took a quick peek at the /health endpoint for the queue proxy and it looks like it is waiting for TCP healthy response from the user-container before returning healthy. This means that our time-to-healthy for the queue proxy will vary based on the start-up time of the user defined container. It might be hard to pick a static value here that will work well for all use-cases. What container are you trying to run in your test? What is the readiness probe setting on that container?

@tanzeeb

tanzeeb commented Apr 30, 2019 •

Copy link
Copy Markdown
Contributor Author

@tcnghia: I just confirmed that the warnings don't happen with istio-lean.yaml

My guess in this case is that the istio-proxy isn't up and as a result nothing listens on port :8022

I think this is spot-on

@tanzeeb

tanzeeb commented Apr 30, 2019

Copy link
Copy Markdown
Contributor Author

Correct. I don't expect the warning to go away, but I expect the container to not fail prematurely. If we are reliably hitting 1-2 failure messages before the container starts it means we are only 1 away from killing the container which would result in a failed Revision creation. Increasing the failureThreshold would simply increase our buffer before failure in the cases where we take slightly longer to come up.

I see what you're saying -- we should increase the failureThreshold because (unrelated to #3308), we will fail a pod if the the health check doesn't return successfully within 3s.

It might be hard to pick a static value here that will work well for all use-cases.

I agree.

Maybe it makes sense to let the queue-proxy's readiness check be configurable, or mirror the settings for user-container?

cc @dgerd @tcnghia @markusthoemmes

@mattmoor

mattmoor commented May 8, 2019

Copy link
Copy Markdown
Contributor

I'm going to close this as it almost certainly isn't the fix we want (it will add a minimum of 2s to cold starts).

Let's discuss in the linked issue.

@mattmoor mattmoor closed this May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/API API objects and controllers cla: yes Indicates the PR's author has signed the CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Good gRPC deployment pods frequently fail at least one health check

8 participants