Skip to content

prometheus-budget source 1 reads the waiting queue, not in-flight load, so the gate stays open under saturation #501

Open

Description

@shimib

Summary

prometheus-budget's source 1, the one a stock llm-d router install lands on, reads only the model server's waiting queue, so the gate stays open through the overload it is meant to shed.

Details

Source 1 queries llm_d_epp_per_endpoint_queue_size (pkg/async/inference/flowcontrol/promql_metric_source_factory.go, NewPoolQueueSizePromQL). The router fills that gauge from the per-pod WaitingQueueSize, which its extractor reads from vllm:num_requests_waiting (pkg/epp/metrics/collectors/inference_pool.go in llm-d-inference-scheduler). Running requests are invisible to it.

The README says max_concurrency mirrors MaxConcurrency in the inference scheduler's saturation detector and that the gate closes at about 95 concurrent requests per pod with defaults. The saturation detector counts in-flight requests, meaning everything dispatched to a pod and not yet finished. vLLM admits up to max_num_seqs (256 by default) into the running batch before anything waits, so with max_concurrency: 100 a pod carries 2.5x the configured capacity before source 1 moves at all, and the gate closes at roughly 350 in-flight requests per pod, not 95.

Sources 0 and 2 have the intended semantics but are not reached on a stock router: source 0 needs the flow-control plugin, and source 2 needs vLLM metrics relabeled with inference_pool; source 1 always resolves first.

Observed

GKE, one Qwen3-0.6B pod behind an llm-d router, hey at 200 concurrent requests: vLLM reported 200 running and 0 waiting, source 1 returned budget 1.0, all five queued async requests dispatched immediately. The e2e-deploy guide's own verification query (vLLM running requests) read -1 at the same moment, so the guide's check and the gate disagree by design and the guide's saturation test cannot pass with source 1.

Proposal

Switch source 1 to running plus waiting using the pool averages the EPP already exports, gated on ready endpoints so a drained pool falls through the cascade instead of reading as idle:

(1 - (avg by(name)(llm_d_epp_average_running_requests{name="P"} + llm_d_epp_average_queue_size{name="P"}) / max_concurrency))
  and on() (llm_d_epp_ready_endpoints{name="P"} > 0)

The original reason for avoiding the pool averages was that the EPP freezes them when the pool drains. That is still true, but since GAIE #2049 (January 2026, in llm-d-router v0.11.0) llm_d_epp_ready_endpoints is written before that early return, so the guard works. The expression is validated against the Prometheus engine for the saturated, idle, drained, multi-replica-EPP and missing-metric cases.

Prepared change, including README and e2e-deploy updates: main...shimib:llm-d-async:fix/budget-source1-inflight (not opened as a PR pending a nod on the semantics).

Trade-offs:

  • Existing deployments will see the gate close earlier, at 95 in-flight per pod with defaults rather than 95 waiting. That is the documented semantics, but it is a behaviour change.
  • Source 1 then requires llm-d-router v0.11.0 or later; older routers fall through to source 2.
  • Source 2 still counts running only; left alone to keep the change scoped.
  • The cleaner long-term fix is a per-endpoint running-requests gauge in the router's collector, so source 1 can return to scrape-time per-pod series.

Workaround without a code change

prometheus-query with the same expression wrapped in clamp(..., 0, 1) reproduces the intended budget today (no baseline parameter, no cascade or vLLM fallback). On routers running flow control, prometheus-saturation on llm_d_epp_flow_control_pool_saturation already has in-flight semantics. The README should say which load source 1 measures until this is fixed; a docs PR follows.

If keeping source 1 as a queue-depth gate and renaming max_concurrency is preferred instead, say so and I will go that way.

Activity

  1. added this to the v1.1.0 milestone on Oct 15, 2026
  2. sohom-cs commented on Nov 25, 2026

    @sohom-cs
    Contributor

    #503's "roughly 350" assumes max_num_seqs is what limits the running batch. If KV blocks cap it lower, current source 1 closes at the cap plus 95 waiting, near 160 in flight per pod for a cap of 64. Renaming max_concurrency would keep that dependence on whatever caps the batch. Source 2 is the mirror case. It counts running only, so with the batch capped at 64, D stays at 0.36 and it never closes. (Arithmetic over the gate formulas, no cluster run.)

    P/D pools aren't covered by the fix or by #503's workarounds. The pool averages carry only the pool name. If they mix prefill and decode pods, a decode pod beside a prefill pod at 10 in flight reaches about 180, nearly twice max_concurrency, before the gate closes.

    prometheus-saturation has its own P/D problem. The router records llm_d_epp_flow_control_pool_saturation per stage (prefill, decode, effective), the query has no stage matcher, and the gate reads only the first sample, so result order picks the stage.

    1. For P/D pools, should the gate follow decode load, or is the pool average acceptable?
    2. Should prometheus-saturation pin one stage, effective for instance, or take the max across stages?

    My suggestion: ship the issue's expression, add waiting to source 2 after all, and pin the saturation query's stage. P/D stays approximate until the router exports per-pod running load with each pod's role.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions