Multiple health checks
It appears that when I have multiple health checks, the deployment of a task will complete as soon as a single health check succeeds rather than waiting for all health checks to succeed. That means the old task will be killed before the new task has reached a healthy state.
Is this expected behavior? I'd rather it wait for all health checks to succeed.
I've observed this through the UI, but I can't see it in the logs, because I don't see the log statements from the HealthCheckActor.
Here is the JSON I am posting to marathon:
{
"backoffFactor": 2,
"backoffSeconds": 10,
"container": {
"docker": {
"image": "mytestcontainer",
"network": "BRIDGE",
"portMappings": [
{
"containerPort": 22925,
"hostPort": 0,
"protocol": "tcp"
},
{
"containerPort": 13001,
"hostPort": 0,
"protocol": "tcp"
}
]
},
"type": "DOCKER"
},
"cpus": 1,
"healthChecks": [
{
"gracePeriodSeconds": 90,
"intervalSeconds": 20,
"maxConsecutiveFailures": 3,
"path": "/status",
"portIndex": 0,
"protocol": "HTTP"
},
{
"gracePeriodSeconds": 90,
"intervalSeconds": 20,
"maxConsecutiveFailures": 3,
"portIndex": 1,
"protocol": "TCP"
}
],
"id": "testing",
"instances": 1,
"mem": 1024.0
}
Bump.
Hi @dsiegel, I agree with you that a task should succeed if all health checks are reporting success.
Have you tried using COMMAND health checks as a work around? They are more scalable anyways since they are not handled from the single marathon master instance but by the slaves.
Are you suggesting a single COMMAND check, like this:
curl X && curl Y && curl Z, instead of 3 separate health checks?
Seems like that should work fine.
What is the point of the marathon based health checks then? Perhaps the marathon TCP/HTTP checks should just generate COMMAND health checks?
Forking to curl is quite expensive operation. It'd be better to support tcp/http health checks from slave processes. That could hide problems like "everything resolves to localhost and not accessible from the outside", though.
More docs on how health checks are performed would be great anyway. Currently there is no indication that COMMAND health checks are launched on slaves.
Hi David,
I meant checking whether the semantics of separate COMMAND checks are actually as desired. Since COMMAND health checks are implemented by Mesos and not inside of Marathon, they might (or might not) have different semantics. But your suggestion should work in any case.
Actually, we thought of letting Marathon generate COMMAND health checks. The problem is that we do not currently have any guarantee that curl (or whatever we use) is installed on every slave.
Best regards, Peter
On Fri, May 22, 2015 at 4:42 PM, David Siegel [email protected] wrote:
Are you suggesting a single COMMAND check, like this:
curl X && curl Y && curl Z, instead of 3 separate health checks?
Seems like that should work fine.
What is the point of the marathon based health checks then? Perhaps the marathon TCP/HTTP checks should just generate COMMAND health checks?
— Reply to this email directly or view it on GitHub https://github.com/mesosphere/marathon/issues/1445#issuecomment-104677932 .
Hi Ian,
probably, you could optimize creating a process for every health check easily with mesos slave support. In practice, it seems to be just cheap enough.
I think that the health checks in Marathon/Mesos are generally not a good solution to monitor availability from the outside. You will need some probe outside of your cluster. Or maybe define a probe host from which the probes are initiated. But that complicates things.
As to the documentation, I agree. We are happy to merge your well-written PR for the docs :)
Best regards, Peter
On Fri, May 22, 2015 at 4:47 PM, Ian Babrou [email protected] wrote:
Forking to curl is quite expensive operation. It'd be better to support tcp/http health checks from slave processes. That could hide problems like "everything resolves to localhost and not accessible from the outside", though.
More docs on how health checks are performed would be great anyway. Currently there is no indication that COMMAND health checks are launched on slaves.
— Reply to this email directly or view it on GitHub https://github.com/mesosphere/marathon/issues/1445#issuecomment-104679205 .
The current logic is indeed: if one health check reports healthy, the whole application is considered healthy.
Any news on this issue? It would be super helpful to be able to specify multiple health checks. My use case is:
- one "real" health check for application health
- one health check with slow interval to check, if the app is hooked in in my service discovery system. this would make marathon removing old versions of an app after the load balancers know about the new version.
Hey @felixb sorry to say we are currently busy on other items. See our board here: https://waffle.io/mesosphere/marathon. We try to schedule this for the next release.
Big +1 on this one from CloudFlare. Would like to use health checks to hook up a few other actions that need to happen at Marathon app startup, unless there's a better way to accomplish that?
+1 , I haven't any idea for around this issue
I have try to skip this issue on one line command check:
curl -I localhost:8080 || exit 1 ; curl -I localhost:5050|| exit 1 ; curl -I localhost:443|| exit 1
was this fixed? multiple curl checks are expensive and will not scale. I was shocked to see an app reporting "Healthly" when clearly one of its health checks are failing. I don't think anybody would expect this behavior.
I think this should at least be documented as I think the expected semantics is that all health checks should pass (and I'm not sure there's a real-world use case for the current behavior).
Note: This issue has been migrated to https://jira.mesosphere.com/browse/MARATHON-2683. For more information see https://groups.google.com/forum/#!topic/marathon-framework/khtvf-ifnp8.