Phase 05/Operating a distributed serving fleet/Multi-node inference and observability
PHASE 05 · Operating a distributed serving fleet

Multi-node inference and observability

0%
8 h6 subtopics3 lessons · 2 required
In plain English

When a model spans two or more machines you lose the ability to look at one screen and understand what is happening. A slow answer could be a slow GPU, a slow network cable, one stuck worker process (a "rank") on another machine, or a queue in the scheduler. Observability is the practice of collecting numbers, logs, and timelines from every machine and stitching them together so that one slow request can be followed across the whole fleet. It is like an airline tracking a bag. Each airport scans the tag, and only by joining all the scans can you see where the bag sat for three hours. In distributed inference the tag is a request ID and the scans are metrics, traces, and per-rank logs.

Why it matters

Multi-node deployments fail in ways single-node ones do not, and most of the time the symptom (high p99) is far from the cause (one rank waiting on a slow link). A metrics and tracing stack that labels everything by rank and node is what lets you find the straggler in minutes instead of days.

Hiring signal

Skills this topic builds, with the number of the 46 analysed job postings that ask for each. Companies asking: Anthropic, Baseten, Cerebras, Cohere, CoreWeave, Crusoe, Databricks, ElevenLabs, Fireworks, Liquid AI, Modal, nvidia, OpenAI, Perplexity, Poolside, Thinking Machines, Together AI, xAI.See all skills →

Learning objectives

  • Deploy a Prometheus and Grafana stack that scrapes vLLM-style metrics from multiple replicas and labels them by node and rank.
  • Define the golden signals for LLM serving (TTFT, inter-token latency, queue depth, KV utilisation, tokens per second) and alert thresholds.
  • Trace a single request across a router and multiple ranks with OpenTelemetry and read the span timeline.
  • Diagnose a straggler rank using per-rank collective timing or torch profiler traces.

Key concepts

Golden signals for LLM serving
TTFT, inter-token latency, requests waiting, KV cache utilisation, prompt and generation tokens per second, preemptions.
Per-rank labelling
Attaching node, pod, and rank labels to every metric and log line so a straggler can be isolated.
Straggler
One rank that is consistently slower, forcing every collective to wait; often a thermal, link, or noisy-neighbour issue.
Distributed tracing
Propagating a trace ID with each request so spans from the router, leader, and workers form one timeline.
DCGM exporter
NVIDIA's Prometheus exporter for GPU utilisation, memory, temperature, NVLink and PCIe throughput, and Xid errors.
Histogram buckets
How latency metrics are exported so p50/p99 can be computed server-side; bucket choice determines precision.
Multi-node vLLM
Running one engine across nodes using Ray or torchrun-style launch with TP inside nodes and PP across them.

Subtopics

  1. 1. What to measure

    Request-level (TTFT, ITL, e2e), engine-level (queue, KV utilisation, batch size, preemptions), hardware-level (DCGM, NVLink, NIC counters).

  2. 2. Metrics pipeline

    Prometheus scraping of /metrics on each replica, DCGM exporter DaemonSet, recording rules for percentiles, Grafana dashboards.

  3. 3. Tracing a request across ranks

    OpenTelemetry context propagation through the router, leader, and workers; vLLM's OTel support; reading span waterfalls.

  4. 4. Finding stragglers

    Per-rank collective wait time, torch.profiler with distributed traces, NCCL timing, correlating with DCGM temperature and link errors.

  5. 5. Launching multi-node vLLM

    Ray cluster or multi-node launch, node discovery, NCCL network interface selection, and the checks to run before serving traffic.

  6. 6. Alerting and SLOs

    Choosing SLOs for TTFT and ITL percentiles, alert thresholds on queue depth and error rate, avoiding alert storms during scale events.

Resources

Hands-on lessons

L1

Metrics stack for a multi-replica stub fleet on kind

CPU · your Maccli150 minrequired

Goal · Prometheus and Grafana on kind scraping three replicas of the Phase 5 stub server, with a dashboard showing TTFT and ITL percentiles per replica and an alert on queue depth.

  1. 1Extend stub_server.py from the resilience topic to export histograms time_to_first_token_seconds and time_per_output_token_seconds and gauges for waiting and running requests, with a replica label from the pod name.
  2. 2Install kube-prometheus-stack via Helm on kind; add a ServiceMonitor for the stub Service.
  3. 3Write recording rules for p50 and p99 of both histograms using histogram_quantile over 1 minute windows.
  4. 4Build a Grafana dashboard with panels for TTFT p99 per replica, ITL p99 per replica, waiting requests, and tokens per second.
  5. 5Add a PrometheusRule alert that fires when waiting requests exceed 10 for 2 minutes; drive load to trigger it and screenshot the firing alert.
  6. 6Inject a 300 ms sleep into one replica only via an environment variable and show its line separating on the dashboard.
Deliverable
Manifests, the dashboard JSON, and two screenshots (alert firing, straggler replica visible).
Check
The dashboard shows three distinct replica series; the slowed replica's ITL p99 is at least 200 ms above the others; the alert transitions to firing under load.
L2

Find the straggler rank with per-rank timing on gloo

CPU · your Macscript120 minrequired

Goal · A four-process torch.distributed program where one rank is secretly slowed, and a per-rank timing report plus a torch.profiler trace that identifies it.

  1. 1Reuse tp_mlp.py; add a hidden delay (time.sleep(0.05)) inside the compute on the rank chosen by an environment variable STRAGGLER_RANK.
  2. 2Wrap compute and all_reduce in timers per rank; after 50 iterations all_gather the (compute_time, wait_time) pairs to rank 0 and print a table.
  3. 3Record a torch.profiler trace on every rank with record_shapes and export Chrome traces named by rank.
  4. 4Open the traces in Perfetto or chrome://tracing and compare the all_reduce span durations across ranks.
  5. 5Write a short note on how the straggler appears (short wait, long compute) versus how the others appear (long wait, short compute).
  6. 6Run with torchrun --nproc_per_node=4 straggler.py and STRAGGLER_RANK in {none, 0, 2}.
Deliverable
straggler.py, the printed per-rank table for each run, and the four trace files for the STRAGGLER_RANK=2 case.
Check
With no straggler all ranks show similar wait time; with STRAGGLER_RANK=2 rank 2 shows the highest compute time and the lowest wait time while the other three show wait time close to 50 ms per iteration.
L3

Two-node vLLM with Ray and a live dashboard

Rented multi-GPUexperiment180 minoptional

Goal · Serve a model across two single-GPU cloud instances with vLLM pipeline parallelism over Ray, scrape its metrics, and measure the inter-node communication share of inter-token latency.

  1. 1Launch two single-GPU instances in the same zone; confirm they can reach each other on the Ray and NCCL ports and record iperf3 bandwidth between them.
  2. 2Start a Ray head on node A and join node B; set NCCL_SOCKET_IFNAME to the private interface.
  3. 3Run vllm serve with --pipeline-parallel-size 2 on a model whose weights fit the two GPUs combined but not one alone (or force PP on a small model for the exercise).
  4. 4Scrape /metrics with a local Prometheus and run `vllm bench serve` at concurrency 1 and 16.
  5. 5Compare inter-token latency with the single-node, single-GPU baseline and attribute the difference to the stage hand-off using your pipeline simulator and the measured bandwidth.
  6. 6Kill node B mid-run and record how the leader's metrics and logs report the failure and how long until the health endpoint fails.
Deliverable
A report with the iperf3 number, the two benchmark tables, the attribution calculation, and the failure timeline.
Check
PP=2 across nodes shows higher ITL than single GPU; the measured per-token hand-off cost is within 2x of bytes_per_token / measured_bandwidth plus a latency floor; the health endpoint reports failure within the configured NCCL timeout.
Fallback
On the Mac run pp_gpt2.py from the pipeline topic under torchrun --nproc_per_node=2 with the stub metrics exporter added to each rank, scrape both ranks with a local Prometheus binary, and reproduce the per-stage timing dashboard; simulate node failure by kill -9 on rank 1 and record how rank 0's recv raises and how long the watchdog takes with a configured timeout of 30 s.

Build your own

Build your own metrics pipeline

PythonCPU · your Mac~6 h

vLLM-named Prometheus metrics exported from your own server and from every rank of a torchrun job, a scrape config with recording rules, a provisioned Grafana dashboard, tested alert rules and a per-request waterfall that names the slow rank.

The real thing: github.com/vllm-project/vllm/tree/main/examples/observability/prometheus_grafana ↗

How you know a stage passes

Write tests/test_metrics.py first. Tests parse /metrics with prometheus_client's text parser and assert exact counters, start a local Prometheus binary against a generated scrape config, run a 2-minute load, and query the HTTP API. Alert rules are checked with `promtool test rules`; the dashboard JSON is validated by a script that runs every panel's PromQL through the API. Run `pytest -q`.

Stages, in order. Each one leaves you with something that runs.0/6
  1. 01instrument the server with vLLM metric names
    Your Phase 3 server exposes vllm:num_requests_running, vllm:num_requests_waiting, vllm:time_to_first_token_seconds, vllm:time_per_output_token_seconds, vllm:prompt_tokens_total, vllm:generation_tokens_total and vllm:gpu_cache_usage_perc.
    test · After 10 requests vllm:prompt_tokens_total equals the exact sum of prompt lengths and the TTFT histogram _count is 10; the exporter output parses without error.
  2. 02per-rank metrics from a torchrun job
    Each rank of the pipeline or TP program serves /metrics on port 9000 plus rank, with step_time_seconds and collective_wait_seconds histograms labelled by rank.
    test · With one rank secretly slowed by 20 ms per step, the rank with the lowest collective_wait_seconds sum is the slowed one and a script prints its rank id correctly in 10 of 10 trials.
  3. 03scrape config and recording rules
    A generated prometheus.yml discovers replicas and ranks with relabeling into replica and rank labels, and recording rules compute p50 and p99 TTFT and ITL per replica and tokens per second.
    test · After a 2-minute load, histogram_quantile(0.99, ...) for TTFT queried via the HTTP API is within 10 percent of the load generator's own p99.
  4. 04the Grafana dashboard
    A provisioned dashboard JSON with TTFT and ITL percentiles per replica, queue depth, KV usage, tokens per second and a per-rank step-time heatmap.
    test · Grafana starts with the provisioning directory and logs zero dashboard errors; the panel checker reports every PromQL expression returning non-empty data during load.
  5. 05alert rules with unit tests
    Alerts for queue depth above a threshold for 2 minutes, TTFT p99 over the SLO, a straggler rank (max over min step time above 1.5) and a scrape target down, each with a runbook URL annotation.
    test · `promtool test rules tests/alerts_test.yml` passes with a firing and a non-firing case per alert; the straggler alert appears in Alertmanager within 3 minutes of slowing a rank.
  6. 06a per-request waterfall across ranks
    A request id propagates through router, replica and ranks; each emits structured span logs that a script assembles into a waterfall.
    test · For one request the spans sum to within 5 percent of the end-to-end latency measured by the client and the longest span belongs to the slowed rank.

Knowledge check

QWhich metrics are the golden signals for an LLM serving endpoint?

Time to first token, inter-token latency, requests waiting, KV cache utilisation, and prompt plus generation tokens per second (plus error rate and preemptions).

QHow does a straggler rank show up in per-rank timings?

The straggler has long compute time and short collective wait; all the healthy ranks show short compute and long wait because they block waiting for it.

QWhy export latency as histograms rather than averages?

Averages hide tail latency; histograms let Prometheus compute p99 across replicas and over time, which is what SLOs are written against.

QWhy must every metric and log line carry node and rank labels in multi-node inference?

Symptoms appear fleet-wide (slow p99) while causes are local to one rank or link; without labels you cannot isolate which one.

Completion

  • All 6 subtopics marked done
  • All 2 required lessons done
  • Lesson l1 dashboard with three replica series and a firing alert captured.
  • Lesson l2 per-rank table correctly identifies the injected straggler.
  • Can list the golden signals and describe how a request trace crosses router, leader, and workers.
Topic progress is derived; it reaches 100% when both checks above pass.Next recommended topic →