|
| 1 | +--- |
| 2 | +title: Introducing service probes |
| 3 | +date: 2025-08-14 |
| 4 | +description: HTTP readiness probes for services, inspired by Kubernetes—safer rollouts and clear runtime visibility. |
| 5 | +slug: probes |
| 6 | +image: https://dstack.ai/static-assets/static-assets/images/dstack-service-probes.png |
| 7 | +categories: |
| 8 | + - Changelog |
| 9 | +--- |
| 10 | + |
| 11 | +# Introducing service probes |
| 12 | + |
| 13 | +`dstack` services are long-running workloads—most often inference endpoints and sometimes web apps—that run continuously on GPU or CPU instances. They can scale across replicas and support rolling deployments. |
| 14 | + |
| 15 | +This release adds HTTP probes inspired by Kubernetes readiness probes. Probes periodically call an endpoint on each replica (for example, `/health`) to confirm it responds as expected. The result gives clear visibility into startup progress and, during rolling deployments, ensures traffic only shifts to a replacement replica after all configured probes have proven ready. |
| 16 | + |
| 17 | +<img src="https://dstack.ai/static-assets/static-assets/images/dstack-service-probes.png" width="630"/> |
| 18 | + |
| 19 | +<!-- more --> |
| 20 | + |
| 21 | +When a service starts, replicas may need time to load models and initialize dependencies. Without probes, a replica is considered ready as soon as the container starts. With probes, readiness is based on real responses. |
| 22 | + |
| 23 | +Each probe sends an HTTP request to a configured endpoint at a set interval. A `2xx` response counts as success. |
| 24 | + |
| 25 | +## Configuration |
| 26 | + |
| 27 | +Probes can be set via the `probes` property in a service configuration: |
| 28 | + |
| 29 | +<div editor-title="service.dstack.yml"> |
| 30 | + |
| 31 | +```yaml |
| 32 | +type: service |
| 33 | +name: llama31 |
| 34 | + |
| 35 | +python: 3.12 |
| 36 | +env: |
| 37 | + - HF_TOKEN |
| 38 | +commands: |
| 39 | + - uv pip install vllm |
| 40 | + - | |
| 41 | + vllm serve meta-llama/Meta-Llama-3.1-8B-Instruct \ |
| 42 | + --max-model-len 4096 \ |
| 43 | + --tensor-parallel-size $DSTACK_GPUS_NUM |
| 44 | +port: 8000 |
| 45 | +model: meta-llama/Meta-Llama-3.1-8B-Instruct |
| 46 | + |
| 47 | +probes: |
| 48 | + - type: http |
| 49 | + url: /health |
| 50 | + interval: 15s |
| 51 | + |
| 52 | +replicas: 2 |
| 53 | + |
| 54 | +resources: |
| 55 | + gpu: 24GB..48GB |
| 56 | +``` |
| 57 | +</div> |
| 58 | +
|
| 59 | +In this example, `dstack` sends a GET `/health` request every 15 seconds to each replica. |
| 60 | + |
| 61 | +## Probe status |
| 62 | + |
| 63 | +<div class="termy"> |
| 64 | + |
| 65 | +```shell |
| 66 | +$ dstack ps --verbose |
| 67 | +
|
| 68 | + NAME BACKEND STATUS PROBES SUBMITTED |
| 69 | + llama31 deployment=1 running 11 mins ago |
| 70 | + replica=0 job=0 deployment=0 aws (us-west-2) running ✓ 11 mins ago |
| 71 | + replica=1 job=0 deployment=1 aws (us-west-2) running × 1 min ago |
| 72 | +``` |
| 73 | + |
| 74 | +</div> |
| 75 | + |
| 76 | +In `dstack ps --verbose`, a replica shows `×` if the last probe failed, `~` while probes are succeeding but the [`ready_after`](../../docs/reference/dstack.yml/service.md#ready_after) threshold is not yet reached, and `✓` once the last `ready_after` checks have succeeded. Probes run for each replica while it is `running`. |
| 77 | + |
| 78 | +## Advanced configuration |
| 79 | + |
| 80 | +Probes support custom HTTP methods, headers (with environment variable interpolation), request bodies, timeouts, and multiple checks in sequence. For example: |
| 81 | + |
| 82 | +```yaml |
| 83 | +env: |
| 84 | + - PROBES_API_KEY |
| 85 | +probes: |
| 86 | + - type: http |
| 87 | + method: post |
| 88 | + url: /check-health |
| 89 | + headers: |
| 90 | + - name: X-API-Key |
| 91 | + value: ${{ env.PROBES_API_KEY }} |
| 92 | + - name: Content-Type |
| 93 | + value: application/json |
| 94 | + body: '{"level": 2}' |
| 95 | + timeout: 20s |
| 96 | +``` |
| 97 | + |
| 98 | +Note: request bodies are not allowed with `GET` or `HEAD` methods. |
| 99 | + |
| 100 | +## Rolling deployments |
| 101 | + |
| 102 | +During a rolling deployment, `dstack` starts a replacement replica, waits for it to be `running` and to pass its probes, then retires the old replica. This preserves availability while large models warm up. |
| 103 | + |
| 104 | +Probes give you visibility about health of each replica. During rolling updates they gate traffic so new replicas receive requests after their checks pass. |
| 105 | + |
| 106 | +See [services](../../docs/concepts/services.md#probes) and the [reference](../../docs/reference/dstack.yml/service.md#probes) for all options. |
| 107 | + |
| 108 | +!!! info "What's next?" |
| 109 | + 1. Check [Quickstart](../../docs/quickstart.md) |
| 110 | + 2. Learn about [services](../../docs/concepts/services.md) |
| 111 | + 3. Join [Discord :material-arrow-top-right-thin:{ .external }](https://discord.gg/u8SmfwPpMd){:target="_blank"} |
0 commit comments