Health Checks & Automatic Recovery
Health Checks & Automatic Recovery
How Deepgram containers report readiness to Amazon SageMaker through the /ping health check, and how SageMaker uses that signal to replace unhealthy instances automatically.
Amazon SageMaker polls a /ping endpoint on every instance backing your Endpoint. That response decides whether the instance receives inference requests, and whether SageMaker replaces it.
Deepgram containers report healthy only when they can actually serve inference — models loaded, inference path functional — rather than answering a static 200. An instance that has failed to load its model reports that state instead of silently collecting requests it cannot serve.
For the platform side of this contract — request timeouts, the startup window, and replacement behavior — see How Your Container Should Respond to Health Check (Ping) Requests in the AWS documentation.
While the container is starting
A Deepgram Endpoint downloads its model artifacts and loads them into GPU memory before serving anything. For larger bundles this takes several minutes. Throughout, /ping returns 503, the Endpoint stays in Creating, and SageMaker routes no traffic. The container logs the reason at INFO:
Once the models load, /ping returns 200, the Endpoint moves to InService, and SageMaker begins routing.
SageMaker allows a bounded window for a new instance to start passing health checks. Miss it and the instance launch fails, leaving the Endpoint in a failed state. Two fields on the production variant extend that window for a large bundle or a slow artifact download:
Both accept up to 3600 seconds. They are ceilings, not delays — raising them does not slow a healthy deployment.
While the Endpoint is serving
SageMaker keeps polling /ping every few seconds. If the container reaches a state where it should not serve — the inference engine stops responding, for example — it reports unhealthy, so SageMaker stops routing new traffic to it and, if the fault persists, replaces it.
Reporting unhealthy is not the same as refusing requests. A container that is simply busy — at its configured stream limit, for example — reports unhealthy while still passing requests through to the inference API: one that fits is served normally, and one that does not receives the API’s own response rather than a generic container error. The container refuses requests itself only when something is genuinely wrong and shedding load is the fastest way back to health.
SageMaker then replaces the instance automatically. Replacement is not instantaneous: AWS requires a sustained failure signal, so a brief blip does not cycle your fleet.
Read health as a metric
/ping is a yes/no signal consumed by SageMaker. The container also publishes the same health state as a Prometheus gauge, sagemaker_endpoint_health, so you can chart it and alarm on it. With detailed observability enabled, it reaches CloudWatch automatically.
All four series are always present. The current state reports 1, the rest report 0:
Because every state is always emitted, an alarm on any one of them never reads “no data” while the container is running. A series that disappears entirely means the scrape failed — a different condition, worth alarming on separately.
Warning before a container is written off
critical is deliberately slow to arrive. A container only reaches it after the inference engine has looked unhealthy continuously for several minutes, so that a container which is simply at its stream limit sheds load and recovers instead of being written off. Any sign of recovery in that window resets the clock.
That means critical is a reliable signal but not an early one. For early warning, use the companion gauge:
It counts down the seconds remaining before the container would enter critical. It reports -1 whenever nothing is counting — the normal reading on a healthy container — and 0 once the container has entered critical.
Guard alarms against that -1, or they fire constantly on healthy containers:
A container that dips into a countdown and returns to -1 recovered on its own, exactly as intended.
The container emits this gauge itself, so /metrics answers even when the internal API and Engine metric sources are not yet reachable — during startup, for example. In that window the response carries the health gauge alone rather than failing the scrape.
Streaming connections use a separate check
/ping reports instance health. Each bidirectional streaming connection has its own liveness check defined by the WebSocket protocol (RFC 6455): SageMaker sends a Ping frame about once a minute, the container replies with a Pong, and several consecutive unanswered Pings close that connection.
The two are independent — a closed connection does not mean the instance is unhealthy, so client applications should reconnect on an unexpected close. See Container Contract to Support Bidirectional Streaming Capabilities.
Health-related log lines
These appear in the Endpoint’s CloudWatch Log Group, /aws/sagemaker/Endpoints/YOUR_ENDPOINT_NAME. See Observability for Amazon SageMaker for how to read and filter them.
When to take action
To catch this before your users do, alarm on Invocation5XXErrors — see Configure CloudWatch alarms.
Related resources
- Observability for Amazon SageMaker
- Prometheus & OpenTelemetry Metrics — how to collect
sagemaker_endpoint_healthand query it with PromQL - Validate a Deepgram SageMaker Endpoint
- Update an Amazon SageMaker Endpoint
- Status Endpoint — the health states a Deepgram node reports, shared with self-hosted deployments
- How Your Container Should Respond to Health Check (Ping) Requests (AWS)
- Custom Inference Code with Hosting Services (AWS)