> This page is for version v1.7.0.
> For other versions, use one of these documentation indexes:
> - Latest (v1.6.2) (default): https://docs.nvidia.com/dynamo/latest/llms.txt
> - dev: https://docs.nvidia.com/dynamo/dev/llms.txt
> - v1.6.2: https://docs.nvidia.com/dynamo/v1.6.2/llms.txt
> - v1.7.0: https://docs.nvidia.com/dynamo/v1.7.0/llms.txt
> - v1.6.1: https://docs.nvidia.com/dynamo/v1.6.1/llms.txt
> - v1.6.0: https://docs.nvidia.com/dynamo/v1.6.0/llms.txt
> - v1.5.1: https://docs.nvidia.com/dynamo/v1.5.1/llms.txt
> - v1.5.0: https://docs.nvidia.com/dynamo/v1.5.0/llms.txt
> - v1.4.2: https://docs.nvidia.com/dynamo/v1.4.2/llms.txt
> - v1.4.1: https://docs.nvidia.com/dynamo/v1.4.1/llms.txt
> - v1.4.0: https://docs.nvidia.com/dynamo/v1.4.0/llms.txt
> - v1.3.0: https://docs.nvidia.com/dynamo/v1.3.0/llms.txt
> - v1.2.1: https://docs.nvidia.com/dynamo/v1.2.1/llms.txt
> - v1.2.0: https://docs.nvidia.com/dynamo/v1.2.0/llms.txt
> - v1.1.1: https://docs.nvidia.com/dynamo/v1.1.1/llms.txt
> - v1.1.0: https://docs.nvidia.com/dynamo/v1.1.0/llms.txt
> - v1.0.2: https://docs.nvidia.com/dynamo/v1.0.2/llms.txt
> - v1.0.1: https://docs.nvidia.com/dynamo/v1.0.1/llms.txt
> - v1.0.0: https://docs.nvidia.com/dynamo/v1.0.0/llms.txt
> - v0.9.1: https://docs.nvidia.com/dynamo/v-0-9-1/llms.txt
> - v0.9.0: https://docs.nvidia.com/dynamo/v-0-9-0/llms.txt
> - v0.8.1: https://docs.nvidia.com/dynamo/v-0-8-1/llms.txt
> - v0.8.0: https://docs.nvidia.com/dynamo/v-0-8-0/llms.txt
> - v0.7.1: https://docs.nvidia.com/dynamo/v-0-7-1/llms.txt
> - v0.7.0: https://docs.nvidia.com/dynamo/v-0-7-0/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.nvidia.com/dynamo/llms.txt. For full content including API reference and SDK examples, see https://docs.nvidia.com/dynamo/llms-full.txt.

# Request Rejection

Request rejection (load shedding) rejects new requests when every eligible worker is overloaded,
rather than accepting work that could exhaust GPU memory or degrade latency for in-flight requests.
Dynamo returns **HTTP 529** for overload by default so clients can distinguish an available but busy
service from **HTTP 503**, which indicates that the service is unavailable.

Rejection is **off by default**. Each threshold is independently opt-in: setting one numeric threshold
enables only that check. You do not need `--admission-control`; that compatibility flag is ignored.

<Note>
The busy-detection formulas, data-parallel rank aggregation, and worker-load event processing are
documented in
[Request Rejection Architecture](/dynamo/v1.7.0/knowledge-base/concepts/fault-tolerance/request-rejection-architecture).
</Note>

<Steps toc={true} tocDepth={2}>

<Step title="Choose the load signals">

Use the signals that match the workers you want to protect:

- Set `--active-decode-blocks-threshold` for decode workers. The value is the fraction of available
  KV cache blocks in use, from `0.0` through `1.0`.
- Set `--active-prefill-tokens-threshold` for an absolute prefill-token limit. This flag is deprecated
  and will be removed in v1.7; use `--active-prefill-tokens-threshold-frac`.
- Set `--active-prefill-tokens-threshold-frac` when the prefill limit should scale with the worker's
  `max_num_batched_tokens` value.

The checks use OR logic. If you configure more than one threshold, exceeding any configured threshold
marks that data-parallel rank as busy. A worker is rejected only after all of its ranks are busy, and a
request is shed only when every eligible worker is busy.

Start conservatively, observe the rejection rate and latency, and then raise the limits. For example,
a decode-block threshold of `0.75` sheds earlier than `0.90`.

</Step>

<Step title="Enable rejection on the Frontend">

Configure thresholds on the **Frontend** component. Decode-block rejection also requires KV router
mode because that mode initializes the worker-load metrics path. For long-output workloads, enable
output-block tracking so generated tokens contribute to the observed KV cache load.

```yaml
- name: Frontend
  type: frontend
  replicas: 1
  podTemplate:
    spec:
      containers:
        - name: main
          image: ${RUNTIME_IMAGE}
          command:
            - python3
            - -m
            - dynamo.frontend
          args:
            - --router-mode
            - kv
            - --active-decode-blocks-threshold
            - "0.85"
            - --router-track-output-blocks
            - --active-prefill-tokens-threshold
            - "10000"
```

`--router-track-output-blocks` is especially important for long generations. Without it, a workload
can fill KV cache with generated tokens without crossing the load value observed by the router.

You can configure just one signal. For example, a prefill-only deployment can omit the decode-block
threshold and KV-specific options. To disable rejection, remove all three threshold settings or set
their environment-variable values to `None`.

See [Frontend Configuration](/dynamo/v1.7.0/reference/components/frontend-configuration#fault-tolerance)
for the complete flag, environment-variable, and validation reference.

</Step>

<Step title="Adjust thresholds at runtime">

Optional. Use the Frontend admin API to change thresholds for a discovered model without redeploying.
The API is off by default. Set `DYN_ENABLE_FRONTEND_ADMIN_API=1` in the Frontend's environment to
serve it on a separate admin port, bound to `127.0.0.1:8002` inside each Frontend pod; the inference
port does not serve it. Add it to the Frontend `main` container from the previous step:

```yaml
        - name: main
          env:
            - name: DYN_ENABLE_FRONTEND_ADMIN_API
              value: "1"
```

`kubectl port-forward` connects through the pod's loopback interface, so you don't need to widen
the bind address. Updates apply to one Frontend process. List the Frontend pods, then port-forward
to one:

```bash
kubectl get pods -n ${NAMESPACE} \
  -l nvidia.com/dynamo-graph-deployment-name=<deployment-name>,nvidia.com/dynamo-component-type=frontend \
  -o name
kubectl port-forward pod/<frontend-pod> 8000:8000 8002:8002 -n ${NAMESPACE}
```

Repeat the port-forward and the `curl` commands below for each Frontend pod you want to change.

Set one or more thresholds:

```bash
curl -X POST http://localhost:8002/busy_threshold \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Qwen/Qwen3-0.6B",
    "active_decode_blocks_threshold": 0.85,
    "active_prefill_tokens_threshold": 10000
  }'
```

Read the stored thresholds:

```bash
curl http://localhost:8002/busy_threshold
```

A numeric value enables only its corresponding check. The router applies the new configuration when
the next worker-load or runtime-configuration update arrives, so the change might not affect a routing
decision immediately. This endpoint does not enable `--router-mode kv` or
`--router-track-output-blocks`; set those when the Frontend starts.

</Step>

<Step title="Verify rejection">

Inspect the configured thresholds and worker-load metrics:

```bash
curl -s http://localhost:8002/busy_threshold
curl -s http://localhost:8000/metrics \
  | grep -E 'dynamo_frontend_worker_active_(decode_blocks|prefill_tokens)'
```

Generate enough load to exceed the configured threshold, then confirm Frontend busy-threshold
rejection:

- The client receives HTTP 529.
- `dynamo_frontend_model_rejection_total` increases for the affected `model` and `endpoint`.

For all metric fields and labels, see
[Cancellation and Rejection](/dynamo/v1.7.0/reference/observability/metrics-catalog#cancellation-and-rejection).

</Step>

</Steps>

## Troubleshoot Decode-Block Rejection

If decode-block load does not produce HTTP 529 responses:

1. Confirm that `GET /busy_threshold` on the admin port (`8002`) shows a numeric `active_decode_blocks_threshold` for the model.
2. Confirm that the Frontend started with `--router-mode kv`.
3. For long-output workloads, confirm that the Frontend started with `--router-track-output-blocks`.
4. Check worker availability on the same Frontend before diagnosing missing load telemetry:

   ```bash
   curl -s http://localhost:8000/metrics \
     | grep -E '^dynamo_frontend_router_(workers|worker_state)\{'
   ```

   Inspect the entries for the affected model, target endpoint, and worker type. A worker with
   `state="excluded"` has no exposed load sample; inspect its `reason`, such as
   `checksum_mismatch`, before troubleshooting the load feed. This reason applies only to the
   rejected worker ID; first-wins admission leaves the incumbent `pending` during initialization or
   `available` after it succeeds. With one healthy incumbent and one incompatible newcomer, expect
   `discovered=2`, `available=1`, `pending=0`, and `excluded=1`; rejection does not remove the
   incumbent. Workers removed from discovery have no per-worker state sample. When the last worker
   disappears and discovery withdraws the group, its `dynamo_frontend_router_workers` series also
   disappears. Available counts of `0` still identify observed groups whose workers are pending or
   excluded. Handle absent series when alerting on worker loss, and verify scrape health and discovery. Inspect each
   Frontend independently rather than aggregating readiness across Frontends. See
   [Router Worker Inventory](/dynamo/v1.7.0/reference/observability/metrics-catalog#router-worker-inventory)
   for the full metric semantics.

5. If the worker is available, check its latest exposed load sample:

   ```bash
   curl -s http://localhost:8000/metrics \
     | grep dynamo_frontend_worker_active_decode_blocks
   ```

6. If the load sample is missing, check Frontend logs for worker-monitor subscription warnings.
7. Confirm that each worker publishes its total KV block count:

   ```bash
   curl -s http://<worker-system-port>/metrics \
     | grep dynamo_component_total_blocks
   ```

8. Verify the event-plane configuration and connectivity between the Frontend and workers.

`--router-track-active-blocks` is a separate routing option. Busy rejection depends on configured
thresholds and worker-load events; it does not require that internal router tracking flag.

## Configure Client Retries

Retry HTTP 529 responses with exponential backoff and jitter. Do not retry every HTTP 503 as if it
were overload; 503 indicates that Dynamo currently has no available service path.

```python
import random
import time


def send_with_retry(request, max_retries=5):
    for attempt in range(max_retries):
        response = send_request(request)
        if response.status_code != 529:
            return response
        wait_time = min(60, (2**attempt) + random.uniform(0, 1))
        time.sleep(wait_time)
    raise RuntimeError("maximum retries exceeded")
```

If an existing client only understands 503 retry semantics, set
`DYN_HTTP_OVERLOAD_STATUS_CODE=503` on the Frontend. The variable accepts values from 200 through
999. Informational values from 100 through 199, invalid values, and out-of-range values fall back to
529. The value is read and cached on first use.

## Related Documentation

- [Admission Control](/dynamo/v1.7.0/kubernetes/fault-tolerance/admission-control) - Configure the backend admission gate on Kubernetes
- [Request Rejection Architecture](/dynamo/v1.7.0/knowledge-base/concepts/fault-tolerance/request-rejection-architecture) - Busy detection, event flow, and overload errors
- [Frontend Configuration](/dynamo/v1.7.0/reference/components/frontend-configuration#fault-tolerance) - Thresholds, overload status, and admin API
- [Metrics Catalog](/dynamo/v1.7.0/reference/observability/metrics-catalog#cancellation-and-rejection) - Frontend rejection metrics
- [Request Migration](/dynamo/v1.7.0/kubernetes/fault-tolerance/request-migration) - Recovering in-flight requests after worker failure