Skip to content

[Nixl] Separate transport-failure metrics from KV expiry - #55854

Merged
NickLucche merged 6 commits into
vllm-project:mainfrom
NickLucche:failed-metrics-separation
Sep 18, 2026
Merged

NickLucche merged 6 commits into
vllm-project:mainfrom
NickLucche:failed-metrics-separation

Conversation

@NickLucche

@NickLucche NickLucche commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Splits NIXL connector failure reporting into two signals: a grouped transport-failure counter for sporadic lower-transport-layer events (or link issues), and a separate KV-expiry counter carrying the autoscaler signal.

Motivation

Every NIXL connector failure currently funnels into a single num_failed_transfers counter, and several failure paths are not counted at all. That conflates two signals that mean very different things operationally:

  • Transport failures — a UCX transfer that failed mid-flight, a handshake that did not complete, a send_notif that could not be posted. These are sporadic events rooted in the lower transport layer; when they spike, the thing to investigate is the network, not the deployment.
  • KV expiry — the prefiller's lease on a request's KV blocks ran out before the decoder read them. This is not a transport problem; it is actionable input for the autoscaler and for lease tuning (kv_lease_duration too short, or scale-down too aggressive).

The old behavior was at its worst on the pull worker's turn-2 path: a request whose KV had simply expired was recorded as a failed transfer, polluting the transport counter with autoscaler signal.

What changes

Signal Covers
vllm:nixl_num_failed_transfers / CLI Num failed transfers transfers + handshakes + failed send_notif — the sporadic transport class
vllm:nixl_num_kv_expired_reqs / CLI Num KV expired reqs KV expiry only — the autoscaler signal
  • KV expiry is no longer counted as a transfer failure. The turn-2 expiry path records num_kv_expired_reqs and reports it separately.
  • Handshake failures are now counted. Two paths previously logged without recording anything: the handshake_setup_failed callback and the push-side push_handshake_failed handler.
  • Failed notifications are folded into the transport counter: a send_notif failure has the same sporadic lower-transport-layer causes as a failed transfer. The separate vllm:nixl_num_failed_notifications counter and CLI field are removed.
  • Closed two previously uncounted failure paths found while tracing notifications:
    • pull-side MLA multi-rank send_notif calls were unguarded, so a failure propagated as an unhandled exception. They now log notification_failed and record the metric.
    • push-side PUSH_REG send_notif failures were logged but neither counted nor reflected in request state. They now record the failure and mark the request failed, matching the adjacent no-agents path.
  • reduce() reports failure counts in both branches, so failures now also surface in the periodic KV Transfer metrics log line, not only via Prometheus.
  • Docs: the metrics reference in nixl_connector_usage.md is updated with the two-signal grouping and its rationale.

Raw per-category keys (num_failed_transfers, num_failed_handshakes, num_failed_notifications) are still recorded internally, so re-splitting the reporting later is a small change.

Testing

New coverage: stats grouping (test_kv_connector_stats_failure_grouping), Prometheus grouping (test_nixl_prom_metrics_group_handshake_with_transfer_failures), handshake-failure metrics in both push and pull suites, and turn-2 gate tests asserting KV expiry records no transport failure.

pre-commit run --files <changed files>          # ruff, mypy-3.10, markdownlint all pass
python -m pytest tests/v1/kv_connector/unit/test_nixl_connector.py -k "stats or prom or handshake"    # 8 passed
python -m pytest tests/v1/kv_connector/unit/test_nixl_push_connector.py                              # 43 passed
python -m pytest tests/v1/kv_connector/unit/test_multi_connector.py -k stats                         # 14 passed
python -m pytest "tests/v1/kv_connector/unit/test_bidirectional_kv_transfer.py::test_turn2_deadline_gate" \
       "tests/v1/kv_connector/unit/test_bidirectional_kv_transfer.py::test_turn2_full_prefix_hit_with_expired_deadline_skips_gate" \
                                                                                                     # 5 passed

The dist_init-heavy suites abort locally after several tests per process (torch.distributed teardown, reproduces on a clean checkout), hence the targeted runs above.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify

mergify Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Documentation preview: https://vllm--55854.org.readthedocs.build/en/55854/

@mergify mergify Bot added documentation Improvements or additions to documentation kv-connector labels Sep 8, 2026
@mergify

mergify Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @NickLucche.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 8, 2026
@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from 4bbae78 to d13e71f Compare September 10, 2026 10:51
@mergify mergify Bot removed the needs-rebase label Sep 10, 2026
@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from deccb96 to d49769d Compare September 11, 2026 14:08
@NickLucche

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88339 for commit d49769d86b45.

@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from f9cd807 to c5729ec Compare September 14, 2026 12:37
@NickLucche

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #88823 for commit c5729ec53e2f.

@njhill njhill left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @NickLucche

@mergify

mergify Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @NickLucche.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 15, 2026
@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from c5729ec to c4a0bb8 Compare September 16, 2026 16:17
@NickLucche

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #89371 for commit c4a0bb82ce66.

@NickLucche
NickLucche enabled auto-merge (squash) September 16, 2026 19:47
@NickLucche
NickLucche disabled auto-merge September 16, 2026 19:47
@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Sep 16, 2026
@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from c4a0bb8 to e01191f Compare September 16, 2026 19:48
@NickLucche

Copy link
Copy Markdown
Member Author

/ci retry

@github-actions

Copy link
Copy Markdown

✅ The previous CI build is still running: https://buildkite.com/vllm/ci/builds/89371

@mergify

mergify Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Hi @NickLucche, the pre-commit checks have failed. Please run:

uv pip install pre-commit>=4.5.1
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from e01191f to e1a562e Compare September 16, 2026 20:11
@NickLucche

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #89434 for commit e1a562e7563d.

@mergify mergify Bot removed the needs-rebase label Sep 17, 2026
NickLucche and others added 4 commits September 17, 2026 15:16
Group transfer, handshake, and notification failures into a single
transport-failure signal (vllm:nixl_num_failed_transfers and the CLI
"Num failed transfers" field), since all are sporadic
lower-transport-layer events. KV expiry is reported separately
(vllm:nixl_num_kv_expired_reqs / "Num KV expired reqs") as it is an
actionable autoscaler signal rather than a transport issue.

Also close two uncounted failure paths found while tracing
notifications: pull-side MLA multi-rank send_notif calls (previously
unguarded) and push-side PUSH_REG send failures (previously logged
but not counted or marked failed).

Raw per-category keys (num_failed_transfers, num_failed_handshakes,
num_failed_notifications) are kept internally for granularity; only
reporting is grouped.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
Count each handshake failure once and keep push receives pending after notification errors. Retain the notification counter alongside grouped transport failures.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
The "handshake" value was never passed to _handle_failed_transfer (the
metric is counted once by _ensure_handshake's own callback), so drop
the dead branch. Replace the optional Literal whose default was not
None with record_failed_transfer: bool, which is all callers use.

Also fix test_do_start_push_kv_drops_request_on_handshake_failure,
stale after the count-once rework: the push side no longer records the
handshake metric, so assert it does not double-record.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
test_log_renders_plain_scalars constructs NixlKVConnectorStats with a
literal dict; after the rebase the num_failed_handshakes and
num_kv_expired_reqs entries were missing, so reduce() raised KeyError.

Co-authored-by: Mistral Vibe <noreply@mistral.ai>

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
@NickLucche
NickLucche force-pushed the failed-metrics-separation branch from e1a562e to 95dc6fd Compare September 17, 2026 13:24
@NickLucche

Copy link
Copy Markdown
Member Author

/ci retry

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #89632 for commit 95dc6fdde912, running 3 failed step(s) from Buildkite CI #89434.

@NickLucche

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #89817 for commit 9bb7cbe40ca4.

@NickLucche
NickLucche merged commit 164dca8 into vllm-project:main Sep 18, 2026
59 checks passed
michael-gpu pushed a commit to practical-inference/vllm-ampere-extended that referenced this pull request Oct 20, 2026
…t#55854)

Signed-off-by: NickLucche <nicolo.lucchesi@mistral.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation kv-connector ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants