Skip to content

Only try once in HTTP health check commands #3469

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

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

epall
Copy link
Contributor

@epall epall commented Apr 23, 2025

The BaseWgetHealthCommand is used to configure readiness and liveness probes that Kubernetes will execute against the ray-worker container. These checks should return fairly quickly so that Kubernetes can get the result and possibly retry them. By default, wget retries 20 times. The retrying should be left to Kubernetes, not wget, so that the command doesn't just hang for minutes while Kubernetes waits for the result.

Why are these changes needed?

Related issue number

Fixes #3468

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

The BaseWgetHealthCommand is used to configure readiness and liveness
probes that Kubernetes will execute against the ray-worker container. These
checks should return fairly quickly so that _Kubernetes_ can get the
result and possibly retry them. By default, wget retries _20 times_. The
retrying should be left to Kubernetes, not wget, so that the command
doesn't just hang for minutes while Kubernetes waits for the result.
@@ -178,7 +178,7 @@ const (
RayAgentRayletHealthPath = "api/local_raylet_healthz"
RayDashboardGCSHealthPath = "api/gcs_healthz"
RayServeProxyHealthPath = "-/healthz"
BaseWgetHealthCommand = "wget -T %d -q -O- http://localhost:%d/%s | grep success"
BaseWgetHealthCommand = "wget --tries 1 -T %d -q -O- http://localhost:%d/%s | grep success"
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please leave a comment why we only retry once?

Copy link
Contributor

@dentiny dentiny left a comment

Choose a reason for hiding this comment

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

[discuss] I'm not sure how useful this change would be, because as long as

  • the overall retry has a timeout
  • retry operations follow exponential backoff

it doesn't matter how many times we attempt retry.
For readiness probe, failureThreshold, along with periodSeconds to define the readiness timeout.

@kevin85421 kevin85421 self-assigned this Apr 24, 2025
@epall
Copy link
Contributor Author

epall commented Apr 26, 2025

You're right! This is a fairly small nit, but what's going on right now is that periodSeconds is causing multiple concurrent invocations of wget to run at the same time. It's just a bit confusing and wasteful.

I absolutely owe ya a proper justification and test cases here. I just wanted to get this down to remember to come back to it, and to see whether it's worth pushing.

While we're discussing...is the | grep success necessary to verify health, or is a HTTP 200 status good enough? Because you could skip all of this and switch to an HTTP check directly from the Kubelet if you don't need to verify the content of the response.

@kevin85421
Copy link
Member

Thanks

@kevin85421 kevin85421 merged commit 510827f into ray-project:master Apr 26, 2025
22 checks passed
@dentiny
Copy link
Contributor

dentiny commented Apr 26, 2025

what's going on right now is that periodSeconds is causing multiple concurrent invocations of wget to run at the same time

Yes, but I don't think the concurrent number would be high, the upper bound of which is failureThreshold.
But anyway, I think this is a valid PR (would be better if we could leave a comment);
my only comment is to configure better overall timeout.

win5923 pushed a commit to win5923/kuberay that referenced this pull request Apr 27, 2025
The BaseWgetHealthCommand is used to configure readiness and liveness
probes that Kubernetes will execute against the ray-worker container. These
checks should return fairly quickly so that _Kubernetes_ can get the
result and possibly retry them. By default, wget retries _20 times_. The
retrying should be left to Kubernetes, not wget, so that the command
doesn't just hang for minutes while Kubernetes waits for the result.
laurafitzgerald pushed a commit to laurafitzgerald/kuberay that referenced this pull request May 7, 2025
The BaseWgetHealthCommand is used to configure readiness and liveness
probes that Kubernetes will execute against the ray-worker container. These
checks should return fairly quickly so that _Kubernetes_ can get the
result and possibly retry them. By default, wget retries _20 times_. The
retrying should be left to Kubernetes, not wget, so that the command
doesn't just hang for minutes while Kubernetes waits for the result.
laurafitzgerald pushed a commit to laurafitzgerald/kuberay that referenced this pull request May 8, 2025
The BaseWgetHealthCommand is used to configure readiness and liveness
probes that Kubernetes will execute against the ray-worker container. These
checks should return fairly quickly so that _Kubernetes_ can get the
result and possibly retry them. By default, wget retries _20 times_. The
retrying should be left to Kubernetes, not wget, so that the command
doesn't just hang for minutes while Kubernetes waits for the result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Readiness checks take minutes to fail
3 participants