<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Observability on vishctl</title><link>https://vishctl.dev/tags/observability/</link><description>Recent content in Observability on vishctl</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 16 Nov 2026 09:00:00 +0800</lastBuildDate><atom:link href="https://vishctl.dev/tags/observability/index.xml" rel="self" type="application/rss+xml"/><item><title>Monitoring vLLM in Production: Six Panels and Four Alerts</title><link>https://vishctl.dev/posts/monitoring-vllm-prometheus-dashboard-alerts/</link><pubDate>Mon, 16 Nov 2026 09:00:00 +0800</pubDate><guid>https://vishctl.dev/posts/monitoring-vllm-prometheus-dashboard-alerts/</guid><category>observability</category><category>prometheus</category><category>vllm</category><category>inference</category><category>kubernetes</category><category>ai-infra</category><description>A simple, diagram-first guide to monitoring a vLLM deployment with Prometheus: why GPU dashboards mislead, the six panels worth building, four alerts that catch real problems, and a triage table for reading them together.</description><content:encoded><![CDATA[<p>Most teams start monitoring LLM serving with a GPU dashboard: utilization, memory, temperature. It looks reassuring. It also misses almost every problem users actually feel.</p>
<p>A GPU that is 98% busy might be serving everyone happily, or it might have 40 requests stuck in a queue. The hardware graphs look the same in both cases.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">GPU dashboard   = is the hardware busy?
</span></span><span class="line"><span class="cl">Model dashboard = are users waiting?
</span></span></code></pre></div><figure class="mermaid-figure">
  <div class="mermaid">flowchart TD
    subgraph HW["GPU dashboard"]
        direction LR
        H1["Utilization<br/>98%"] h1@--> H2["Memory<br/>72 of 80 GB"]
        H2 h2@--> H3["Looks fine"]
    end

    subgraph MODEL["Model dashboard"]
        direction LR
        M1["25 requests<br/>waiting"] m1@--> M2["P95 TTFT<br/>6 seconds"]
        M2 m2@--> M3["Users are<br/>waiting"]
    end

    HW ~~~ MODEL
    h1@{ animate: true }
    h2@{ animate: true }
    m1@{ animate: true }
    m2@{ animate: true }

    classDef idle fill:#101e27,stroke:#324950,color:#8aa0a8;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:2px;
    classDef tree fill:#281d48,stroke:#a78bfa,color:#f1edff,stroke-width:2px;
    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    class H1,H2 idle;
    class H3 gpu;
    class M1,M2 tree;
    class M3 warn;</div>
  <figcaption>Top: the hardware view of an overloaded server looks healthy. Bottom: the model server&#39;s own metrics show the queue and the slow first tokens.</figcaption>
</figure>

<p>This post is the production follow-up to my <a href="https://vishctl.dev/posts/llm-inference-metrics-ttft-tpot-throughput-goodput/">inference metrics guide</a>. That one explains what TTFT and TPOT mean. This one shows which graphs to build, which alerts to set, and how to read them together at 2 a.m.</p>
<h2 id="where-each-metric-comes-from">Where each metric comes from</h2>
<p>vLLM publishes its own metrics at <code>/metrics</code> in Prometheus format. Several of them time one specific stage of a request:</p>
<figure class="mermaid-figure">
  <div class="mermaid">flowchart LR
    A["Request<br/>arrives"] s1@--> Q["Queue<br/>queue_time"]
    Q s2@--> P["Prefill<br/>prefill_time"]
    P s3@--> D["Decode<br/>decode_time"]
    D s4@--> E["Done<br/>e2e_latency"]

    s1@{ animate: true }
    s2@{ animate: true }
    s3@{ animate: true }
    s4@{ animate: true }

    classDef input fill:#13264a,stroke:#38bdf8,color:#e6f6ff,stroke-width:2px;
    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    classDef tree fill:#281d48,stroke:#a78bfa,color:#f1edff,stroke-width:2px;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:2px;
    class A input;
    class Q warn;
    class P tree;
    class D,E gpu;</div>
  <figcaption>One request passes through three stages. vLLM times each one separately (request_queue_time_seconds, request_prefill_time_seconds, request_decode_time_seconds) plus the whole trip (e2e_request_latency_seconds).</figcaption>
</figure>

<p>Every name below carries the <code>vllm:</code> prefix. There are three kinds:</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Kind</th>
            <th scope="col">What it is</th>
            <th scope="col">Examples</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Gauge</td>
            <td>A value right now</td>
            <td><code>num_requests_running</code>, <code>num_requests_waiting</code>, <code>kv_cache_usage_perc</code></td>
        </tr>
        <tr>
            <td>Counter</td>
            <td>A total that only goes up</td>
            <td><code>prompt_tokens</code>, <code>generation_tokens</code>, <code>prefix_cache_hits</code></td>
        </tr>
        <tr>
            <td>Histogram</td>
            <td>A spread of timings</td>
            <td><code>time_to_first_token_seconds</code>, <code>inter_token_latency_seconds</code></td>
        </tr>
    </tbody>
  </table>
</div>
<p>Two details save a lot of confusion later:</p>
<ul>
<li><strong>Counters get a <code>_total</code> suffix in Prometheus.</strong> The counter <code>vllm:generation_tokens</code> is queried as <code>vllm:generation_tokens_total</code>.</li>
<li><strong>Histograms get a <code>_bucket</code> suffix.</strong> Percentiles are calculated from <code>vllm:time_to_first_token_seconds_bucket</code>.</li>
</ul>
<p>Metric names change between vLLM releases. Before copying any query, check what your version exposes:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -s http://localhost:8000/metrics <span class="p">|</span> grep <span class="s1">&#39;^# HELP vllm&#39;</span> <span class="p">|</span> cut -d<span class="s1">&#39; &#39;</span> -f3
</span></span></code></pre></div><h2 id="the-six-panels">The six panels</h2>
<p>A useful dashboard answers four questions: how much traffic, how slow, how full, and how well the cache works. Six panels cover them.</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Panel</th>
            <th scope="col">Question it answers</th>
            <th scope="col">Healthy looks like</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1. Traffic</td>
            <td>How much work is arriving?</td>
            <td>Follows your usual daily shape</td>
        </tr>
        <tr>
            <td>2. Queue</td>
            <td>Is anyone waiting for a slot?</td>
            <td>Flat at zero</td>
        </tr>
        <tr>
            <td>3. TTFT</td>
            <td>How long until the first token?</td>
            <td>P95 inside your target</td>
        </tr>
        <tr>
            <td>4. Token speed</td>
            <td>How smooth is the stream?</td>
            <td>Steady, no spikes</td>
        </tr>
        <tr>
            <td>5. KV cache</td>
            <td>How full is GPU memory?</td>
            <td>Below about 90%</td>
        </tr>
        <tr>
            <td>6. Prefix cache</td>
            <td>Is repeated context being reused?</td>
            <td>Stable hit rate</td>
        </tr>
    </tbody>
  </table>
</div>
<h3 id="1-traffic">1. Traffic</h3>
<p>Output tokens per second is the best single measure of how hard the server is working:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">sum(rate(vllm:generation_tokens_total[5m]))
</span></span></code></pre></div><p>Add input tokens as a second line. A jump in input with flat output usually means someone started sending much longer prompts.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">sum(rate(vllm:prompt_tokens_total[5m]))
</span></span></code></pre></div><h3 id="2-queue">2. Queue</h3>
<p>This is the most important panel on the page. Plot running and waiting together:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">sum(vllm:num_requests_running)
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">sum(vllm:num_requests_waiting)
</span></span></code></pre></div><p>Running goes up and down with traffic. Waiting should sit at zero. <strong>Any sustained value above zero means you are out of capacity.</strong></p>
<h3 id="3-time-to-first-token">3. Time to first token</h3>
<p>Show P50, P95, and P99 as three lines:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">histogram_quantile(0.95, sum by (le) (rate(vllm:time_to_first_token_seconds_bucket[5m])))
</span></span></code></pre></div><p>Change <code>0.95</code> to <code>0.50</code> and <code>0.99</code> for the other two. When P50 is calm but P99 climbs, a few requests are queueing or carrying very long prompts.</p>
<h3 id="4-token-speed">4. Token speed</h3>
<p>Inter-token latency shows how smoothly answers stream:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">histogram_quantile(0.95, sum by (le) (rate(vllm:inter_token_latency_seconds_bucket[5m])))
</span></span></code></pre></div><p>This line rises gently as the batch gets bigger. A sudden step up usually means a noisy neighbor on a <a href="https://vishctl.dev/posts/kubernetes-gpu-sharing-time-slicing-mps-mig/">shared GPU</a> or a batch that grew too large.</p>
<h3 id="5-kv-cache-usage">5. KV cache usage</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">max by (pod) (vllm:kv_cache_usage_perc)
</span></span></code></pre></div><p>The value runs from 0 to 1. Near 1.0, the server has no memory left for new context, so requests wait or get preempted. The <a href="https://vishctl.dev/posts/llm-gpu-memory-sizing-weights-kv-cache/">GPU memory sizing guide</a> explains what fills it.</p>
<h3 id="6-prefix-cache-hit-rate">6. Prefix cache hit rate</h3>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">sum(rate(vllm:prefix_cache_hits_total[5m]))
</span></span><span class="line"><span class="cl">  /
</span></span><span class="line"><span class="cl">sum(rate(vllm:prefix_cache_queries_total[5m]))
</span></span></code></pre></div><p>This is the share of prompt tokens that were served from cache instead of being recomputed. A high number means cheap, fast prefills. A sudden drop usually means a prompt template changed, or requests started landing on replicas that have not seen their prefix.</p>
<h3 id="bonus-one-gpu-row">Bonus: one GPU row</h3>
<p>The hardware view still matters for hardware problems. If you run NVIDIA&rsquo;s DCGM exporter, three graphs are enough:</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Graph</th>
            <th scope="col">Metric</th>
            <th scope="col">Catches</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>GPU memory used</td>
            <td><code>DCGM_FI_DEV_FB_USED</code></td>
            <td>A neighbor eating shared memory</td>
        </tr>
        <tr>
            <td>Temperature</td>
            <td><code>DCGM_FI_DEV_GPU_TEMP</code></td>
            <td>Cooling problems and throttling</td>
        </tr>
        <tr>
            <td>Utilization</td>
            <td><code>DCGM_FI_DEV_GPU_UTIL</code></td>
            <td>A GPU that is idle when it should not be</td>
        </tr>
    </tbody>
  </table>
</div>
<p>Use utilization to spot an idle GPU. Do not use it to judge load.</p>
<h2 id="reading-the-panels-together">Reading the panels together</h2>
<p>One panel rarely tells the story. The combination does. Here is one incident, step by step:</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Time</th>
            <th scope="col">What the panels show</th>
            <th scope="col">What it means</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>14:00</td>
            <td>Traffic normal, queue 0, P95 TTFT 300 ms</td>
            <td>Healthy</td>
        </tr>
        <tr>
            <td>14:05</td>
            <td>Input tokens triple, output tokens flat</td>
            <td>Someone is sending much longer prompts</td>
        </tr>
        <tr>
            <td>14:08</td>
            <td>KV cache at 0.97, queue climbs to 12</td>
            <td>Memory is full, new requests cannot start</td>
        </tr>
        <tr>
            <td>14:10</td>
            <td>P95 TTFT 7 s, token speed unchanged</td>
            <td>Users wait to start, but streams are still smooth</td>
        </tr>
    </tbody>
  </table>
</div>
<p>The fix here is not &ldquo;add GPUs because TTFT is high&rdquo;. It is &ldquo;find the client sending huge prompts&rdquo;, or cap prompt length. The panels tell you that because TTFT, the queue, and the KV cache moved together while token speed stayed flat.</p>
<h3 id="a-triage-table">A triage table</h3>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Queue</th>
            <th scope="col">TTFT</th>
            <th scope="col">Token speed</th>
            <th scope="col">KV cache</th>
            <th scope="col">Most likely cause</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Growing</td>
            <td>High</td>
            <td>Normal</td>
            <td>Normal</td>
            <td>Not enough replicas for the request rate</td>
        </tr>
        <tr>
            <td>Growing</td>
            <td>High</td>
            <td>Normal</td>
            <td>Near full</td>
            <td>Long prompts filling memory</td>
        </tr>
        <tr>
            <td>Zero</td>
            <td>High</td>
            <td>Normal</td>
            <td>Normal</td>
            <td>Long prompts with no cache hits</td>
        </tr>
        <tr>
            <td>Zero</td>
            <td>Normal</td>
            <td>Slow</td>
            <td>Normal</td>
            <td>Batch too large, or a noisy neighbor</td>
        </tr>
        <tr>
            <td>Zero</td>
            <td>Normal</td>
            <td>Normal</td>
            <td>Normal</td>
            <td>Healthy. Look at the client or network</td>
        </tr>
    </tbody>
  </table>
</div>
<figure class="mermaid-figure">
  <div class="mermaid">flowchart TD
    Q1["TTFT is high"] t1@--> Q2["Is the queue<br/>above zero?"]
    Q2 t2@-->|"Yes"| Q3["Is the KV cache<br/>near full?"]
    Q2 t3@-->|"No"| Q4["Did the prefix<br/>hit rate drop?"]
    Q3 t4@-->|"Yes"| A1["Long prompts<br/>cap length"]
    Q3 t5@-->|"No"| A2["Too few<br/>replicas"]
    Q4 t6@-->|"Yes"| A3["Cache misses<br/>check routing"]
    Q4 t7@-->|"No"| A4["Longer<br/>prompts"]

    t1@{ animate: true }
    t2@{ animate: true }
    t3@{ animate: true }
    t4@{ animate: true }
    t5@{ animate: true }
    t6@{ animate: true }
    t7@{ animate: true }

    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    classDef question fill:#281d48,stroke:#a78bfa,color:#f1edff,stroke-width:2px;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:2px;
    class Q1 warn;
    class Q2,Q3,Q4 question;
    class A1,A2,A3,A4 gpu;</div>
  <figcaption>A short path for the most common complaint: the first token is slow. Check the queue first, then the cache. The fixes: cap prompt length or add memory, scale out, check prompt templates and routing, or look at who is sending more input tokens.</figcaption>
</figure>

<h2 id="the-four-alerts">The four alerts</h2>
<p>Dashboards are for looking. Alerts are for when nobody is looking. Keep the list short, and make every alert mean &ldquo;a user is affected or about to be&rdquo;.</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Alert</th>
            <th scope="col">Fires when</th>
            <th scope="col">Why this one</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Queue backlog</td>
            <td>Requests have been waiting for 2 minutes</td>
            <td>The earliest sign of overload</td>
        </tr>
        <tr>
            <td>Slow first token</td>
            <td>P95 TTFT is over target for 10 minutes</td>
            <td>What users actually feel</td>
        </tr>
        <tr>
            <td>KV cache nearly full</td>
            <td>Usage above 0.95 for 10 minutes</td>
            <td>Predicts the next queue backlog</td>
        </tr>
        <tr>
            <td>Server down</td>
            <td>A vLLM Pod stops answering scrapes</td>
            <td>Covers crashes and stuck Pods</td>
        </tr>
    </tbody>
  </table>
</div>
<p>With the Prometheus Operator, they fit in one <code>PrometheusRule</code>. Adjust the namespace, the thresholds, and the <code>job</code> label to match your setup:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-yaml" data-lang="yaml"><span class="line"><span class="cl"><span class="c"># vllm-alerts.yaml</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">apiVersion</span><span class="p">:</span><span class="w"> </span><span class="l">monitoring.coreos.com/v1</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">kind</span><span class="p">:</span><span class="w"> </span><span class="l">PrometheusRule</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">metadata</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">vllm-alerts</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">namespace</span><span class="p">:</span><span class="w"> </span><span class="l">llm</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="nt">spec</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">  </span><span class="nt">groups</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">    </span>- <span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l">vllm</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">      </span><span class="nt">rules</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="nt">alert</span><span class="p">:</span><span class="w"> </span><span class="l">VLLMQueueBacklog</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">expr</span><span class="p">:</span><span class="w"> </span><span class="l">sum by (namespace) (vllm:num_requests_waiting) &gt; 5</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">for</span><span class="p">:</span><span class="w"> </span><span class="l">2m</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">severity</span><span class="p">:</span><span class="w"> </span><span class="l">warning</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">annotations</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">summary</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;vLLM has had requests waiting for 2 minutes&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">description</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;Capacity is exhausted. Check autoscaling and the KV cache panel.&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="nt">alert</span><span class="p">:</span><span class="w"> </span><span class="l">VLLMSlowFirstToken</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">expr</span><span class="p">:</span><span class="w"> </span><span class="p">|</span><span class="sd">
</span></span></span><span class="line"><span class="cl"><span class="sd">            histogram_quantile(0.95,
</span></span></span><span class="line"><span class="cl"><span class="sd">              sum by (le, namespace) (rate(vllm:time_to_first_token_seconds_bucket[5m]))
</span></span></span><span class="line"><span class="cl"><span class="sd">            ) &gt; 2</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">for</span><span class="p">:</span><span class="w"> </span><span class="l">10m</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">severity</span><span class="p">:</span><span class="w"> </span><span class="l">warning</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">annotations</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">summary</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;P95 time to first token is above 2 seconds&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="nt">alert</span><span class="p">:</span><span class="w"> </span><span class="l">VLLMKVCacheNearlyFull</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">expr</span><span class="p">:</span><span class="w"> </span><span class="l">max by (namespace, pod) (vllm:kv_cache_usage_perc) &gt; 0.95</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">for</span><span class="p">:</span><span class="w"> </span><span class="l">10m</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">severity</span><span class="p">:</span><span class="w"> </span><span class="l">warning</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">annotations</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">summary</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;KV cache on {{ $labels.pod }} is above 95 percent&#34;</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">        </span>- <span class="nt">alert</span><span class="p">:</span><span class="w"> </span><span class="l">VLLMDown</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">expr</span><span class="p">:</span><span class="w"> </span><span class="l">up{job=&#34;llm/vllm&#34;} == 0</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">for</span><span class="p">:</span><span class="w"> </span><span class="l">2m</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">labels</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">severity</span><span class="p">:</span><span class="w"> </span><span class="l">critical</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">          </span><span class="nt">annotations</span><span class="p">:</span><span class="w">
</span></span></span><span class="line"><span class="cl"><span class="w">            </span><span class="nt">summary</span><span class="p">:</span><span class="w"> </span><span class="s2">&#34;A vLLM Pod has stopped answering metric scrapes&#34;</span><span class="w">
</span></span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">kubectl apply -f vllm-alerts.yaml
</span></span></code></pre></div><p>Then confirm Prometheus loaded the rules:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">kubectl -n llm get prometheusrule vllm-alerts
</span></span></code></pre></div><p>Three choices in that file are deliberate:</p>
<ul>
<li><strong>Every alert has a <code>for</code> duration.</strong> A two-second blip should not page anyone.</li>
<li><strong>Thresholds come from your own target.</strong> The 2 seconds for TTFT is an example. Use the number you promised your users.</li>
<li><strong>There is no alert on GPU utilization.</strong> It is near 100% whenever the server is doing its job.</li>
</ul>
<p>The <code>job</code> label depends on how your scrape is configured. Find the real value with this query, then update the last rule:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">count by (job) (vllm:num_requests_running)
</span></span></code></pre></div><h2 id="mistakes-worth-avoiding">Mistakes worth avoiding</h2>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Mistake</th>
            <th scope="col">What goes wrong</th>
            <th scope="col">Do this instead</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Alerting on averages</td>
            <td>One slow request in a hundred never shows up</td>
            <td>Alert on P95 or P99</td>
        </tr>
        <tr>
            <td>Alerting on GPU utilization</td>
            <td>It fires all day, so everyone mutes it</td>
            <td>Alert on the queue</td>
        </tr>
        <tr>
            <td>One dashboard per Pod only</td>
            <td>You miss the fleet-wide picture</td>
            <td>Sum across Pods, then break down by Pod</td>
        </tr>
        <tr>
            <td>Short rate windows</td>
            <td>Graphs are too spiky to read</td>
            <td>Use 5 minute windows for latency</td>
        </tr>
        <tr>
            <td>No alert for missing data</td>
            <td>A dead server looks like a quiet one</td>
            <td>Keep the &ldquo;server down&rdquo; alert</td>
        </tr>
        <tr>
            <td>Watching only latency</td>
            <td>You see the symptom, not the cause</td>
            <td>Keep queue and KV cache next to it</td>
        </tr>
    </tbody>
  </table>
</div>
<h2 id="try-it-without-a-gpu">Try it without a GPU</h2>
<p>You can practice all of this on a laptop. The <a href="https://vishctl.dev/posts/simulate-gpu-vllm-llm-d-on-laptop/">GPU simulation lab</a> runs a simulated vLLM that publishes vLLM-style metrics, so the queue and latency queries have something to read. It exposes a subset of the real metric list, so run the <code>grep</code> command from earlier to see which panels will have data.</p>
<p>Once the panels work, connect them to action: the queue metric from panel 2 is the same signal that drives scaling in my <a href="https://vishctl.dev/posts/autoscaling-llm-inference-kubernetes-keda/">autoscaling guide</a>.</p>
<h2 id="cheat-sheet">Cheat sheet</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Model metrics      = what vLLM reports about requests; the view that shows user pain
</span></span><span class="line"><span class="cl">GPU metrics        = what the hardware reports; good for hardware faults, poor for load
</span></span><span class="line"><span class="cl">Gauge              = a value right now, such as requests waiting
</span></span><span class="line"><span class="cl">Counter            = a growing total; query it with rate() and a _total suffix
</span></span><span class="line"><span class="cl">Histogram          = a spread of timings; percentiles come from the _bucket series
</span></span><span class="line"><span class="cl">Queue panel        = requests waiting; should be flat at zero
</span></span><span class="line"><span class="cl">TTFT panel         = P50, P95, P99 time to first token
</span></span><span class="line"><span class="cl">KV cache usage     = 0 to 1; near 1 means no memory left for new context
</span></span><span class="line"><span class="cl">Prefix hit rate    = cached prompt tokens / all prompt tokens
</span></span><span class="line"><span class="cl">PrometheusRule     = the Prometheus Operator resource that holds alert rules
</span></span><span class="line"><span class="cl">for: 2m            = the condition must hold this long before the alert fires
</span></span><span class="line"><span class="cl">Rule of thumb      = alert on the queue and on P95 TTFT, never on GPU utilization
</span></span></code></pre></div><p>To understand the numbers on these panels, start with the <a href="https://vishctl.dev/posts/llm-inference-metrics-ttft-tpot-throughput-goodput/">inference metrics guide</a>. To act on them automatically, continue to <a href="https://vishctl.dev/posts/autoscaling-llm-inference-kubernetes-keda/">autoscaling LLM inference on Kubernetes</a>.</p>
]]></content:encoded></item><item><title>LLM Inference Metrics, Simply: TTFT, TPOT, Throughput, and Goodput</title><link>https://vishctl.dev/posts/llm-inference-metrics-ttft-tpot-throughput-goodput/</link><pubDate>Fri, 13 Nov 2026 09:00:00 +0800</pubDate><guid>https://vishctl.dev/posts/llm-inference-metrics-ttft-tpot-throughput-goodput/</guid><category>inference</category><category>benchmarking</category><category>latency</category><category>vllm</category><category>observability</category><category>ai-infra</category><description>A simple, diagram-first guide to reading LLM serving numbers: what TTFT, TPOT, ITL, throughput, percentiles, and goodput measure, how they trade off, and a 40-line script to measure them on any OpenAI-compatible endpoint.</description><content:encoded><![CDATA[<p>A benchmark says your model server does 2,000 tokens per second. A user says the chatbot feels slow. Both can be true at the same time.</p>
<p>They are looking at different clocks. Almost every confusing LLM performance conversation comes down to mixing these two up:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Latency    = how long ONE user waits     (TTFT, TPOT, end-to-end)
</span></span><span class="line"><span class="cl">Throughput = how much ALL users get done (tokens per second, requests per second)
</span></span></code></pre></div><figure class="mermaid-figure">
  <div class="mermaid">flowchart TD
    subgraph USER["One user's view"]
        direction LR
        U1["Send<br/>prompt"] a1@--> U2["Wait for<br/>first word"]
        U2 a2@--> U3["Read the<br/>stream"]
        U3 a3@--> U4["Answer done<br/>7.8 s"]
    end

    subgraph PLATFORM["The platform's view"]
        direction LR
        P1["32 users<br/>at once"] b1@--> P2["One GPU<br/>one batch"]
        P2 b2@--> P3["960 tokens<br/>per second"]
    end

    USER ~~~ PLATFORM
    a1@{ animate: true }
    a2@{ animate: true }
    a3@{ animate: true }
    b1@{ animate: true }
    b2@{ animate: true }

    classDef input fill:#13264a,stroke:#38bdf8,color:#e6f6ff,stroke-width:2px;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:2px;
    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    class U1,P1 input;
    class U2,U3 warn;
    class U4,P2,P3 gpu;</div>
  <figcaption>Top: one user cares about their own wait. Bottom: the platform cares about total work per GPU. The same server produces both numbers.</figcaption>
</figure>

<p>This post explains each metric with one running example, then gives you a small script to measure them yourself. It works on vLLM, SGLang, Ollama, LM Studio, or anything else that speaks the OpenAI API.</p>
<p>If terms like prefill, decode, and KV cache are new, read <a href="https://vishctl.dev/posts/llm-basics-visual-guide/">What Happens When You Ask an LLM a Question</a> first.</p>
<h2 id="one-request-four-clocks">One request, four clocks</h2>
<p>Here is the life of a single streaming request, split at the moment the first token arrives. Every latency metric is just a stopwatch between two of these points.</p>
<figure class="mermaid-figure">
  <div class="mermaid">flowchart TD
    subgraph WAIT["Before first token"]
        direction LR
        S["Request<br/>sent"] e1@--> Q["Queue<br/>wait for a slot"]
        Q e2@--> P["Prefill<br/>read the prompt"]
        P e3@--> F["First token<br/>arrives"]
    end

    subgraph STREAM["After first token"]
        direction LR
        D1["Token 2"] e4@--> D2["Token 3"]
        D2 e5@--> D3["...and<br/>so on"]
        D3 e6@--> L["Last token<br/>arrives"]
    end

    WAIT ~~~ STREAM
    e1@{ animate: true }
    e2@{ animate: true }
    e3@{ animate: true }
    e4@{ animate: true }
    e5@{ animate: true }
    e6@{ animate: true }

    classDef input fill:#13264a,stroke:#38bdf8,color:#e6f6ff,stroke-width:2px;
    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    classDef router fill:#281d48,stroke:#a78bfa,color:#f1edff,stroke-width:2px;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:2px;
    class S input;
    class Q warn;
    class P router;
    class F,D1,D2,D3,L gpu;</div>
  <figcaption>Top: everything before the first token adds up to TTFT. Bottom: the gaps between the tokens after it are what TPOT averages.</figcaption>
</figure>

<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Metric</th>
            <th scope="col">Starts at</th>
            <th scope="col">Stops at</th>
            <th scope="col">Plain meaning</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><strong>TTFT</strong></td>
            <td>Request sent</td>
            <td>First token</td>
            <td>How long until something shows up</td>
        </tr>
        <tr>
            <td><strong>TPOT</strong></td>
            <td>First token</td>
            <td>Last token, divided by tokens</td>
            <td>How fast the text streams</td>
        </tr>
        <tr>
            <td><strong>ITL</strong></td>
            <td>One token</td>
            <td>The next token</td>
            <td>The gap between two tokens</td>
        </tr>
        <tr>
            <td><strong>End-to-end</strong></td>
            <td>Request sent</td>
            <td>Last token</td>
            <td>How long until the answer is complete</td>
        </tr>
    </tbody>
  </table>
</div>
<h3 id="the-running-example">The running example</h3>
<p>One request, with made-up but realistic numbers:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Prompt:  2,000 tokens      Answer: 300 tokens
</span></span><span class="line"><span class="cl">Queue:   50 ms             Prefill: 250 ms
</span></span><span class="line"><span class="cl">Decode:  25 ms per token
</span></span></code></pre></div><div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Step</th>
            <th scope="col">What happens</th>
            <th scope="col">Clock reads</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>Request waits in the queue</td>
            <td>50 ms</td>
        </tr>
        <tr>
            <td>2</td>
            <td>GPU reads the 2,000-token prompt (prefill)</td>
            <td>300 ms</td>
        </tr>
        <tr>
            <td>3</td>
            <td>First token is sent back</td>
            <td>300 ms: this is the <strong>TTFT</strong></td>
        </tr>
        <tr>
            <td>4</td>
            <td>299 more tokens arrive, 25 ms apart</td>
            <td>7,775 ms: this is the <strong>end-to-end latency</strong></td>
        </tr>
    </tbody>
  </table>
</div>
<p>Keep these numbers in mind. Every section below refers back to them.</p>
<h2 id="1-ttft-time-to-first-token">1. TTFT: time to first token</h2>
<p><strong>TTFT is the wait before anything appears.</strong> It is the number that decides whether a chat feels responsive.</p>
<p>In the example, TTFT is 300 ms. It has three ingredients:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">TTFT = network time + queue time + prefill time
</span></span></code></pre></div><p>What makes it worse:</p>
<ul>
<li><strong>Long prompts.</strong> Prefill has to read every input token. A 20,000-token prompt takes far longer than a 2,000-token one.</li>
<li><strong>A busy server.</strong> If every slot is taken, the request sits in the queue first.</li>
<li><strong>Cold caches.</strong> If the server has seen the start of this prompt before, it can skip most of the prefill. That is what prefix caching does.</li>
</ul>
<p>This is why TTFT is the metric that <a href="https://vishctl.dev/posts/why-lmcache-is-needed/">LMCache</a> and cache-aware routers like <a href="https://vishctl.dev/posts/llm-d-kubernetes-inference-routing/">llm-d</a> target. They do not make tokens generate faster. They make the first one arrive sooner.</p>
<h2 id="2-tpot-and-itl-how-fast-the-text-streams">2. TPOT and ITL: how fast the text streams</h2>
<p><strong>TPOT (time per output token)</strong> is the average gap between tokens after the first one. It is calculated once per request:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">TPOT = (end-to-end latency - TTFT) / (output tokens - 1)
</span></span><span class="line"><span class="cl">     = (7,775 ms - 300 ms) / 299
</span></span><span class="line"><span class="cl">     = 25 ms
</span></span></code></pre></div><p>Flip it over and you get the speed one user sees: <code>1000 / 25 = 40 tokens per second</code>.</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">TPOT</th>
            <th scope="col">Tokens per second</th>
            <th scope="col">How it feels</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>200 ms</td>
            <td>5</td>
            <td>Slower than most people read</td>
        </tr>
        <tr>
            <td>100 ms</td>
            <td>10</td>
            <td>Comfortable reading pace</td>
        </tr>
        <tr>
            <td>50 ms</td>
            <td>20</td>
            <td>Faster than you can read</td>
        </tr>
        <tr>
            <td>25 ms</td>
            <td>40</td>
            <td>Feels instant for chat</td>
        </tr>
        <tr>
            <td>10 ms</td>
            <td>100</td>
            <td>Only matters for agents and long outputs</td>
        </tr>
    </tbody>
  </table>
</div>
<p>For a human reading a chat reply, anything under about 50 ms is already faster than their eyes. For an <strong>agent</strong> that waits for the full answer before acting, every millisecond of TPOT still counts.</p>
<h3 id="itl-is-the-same-idea-measured-per-gap">ITL is the same idea, measured per gap</h3>
<p><strong>ITL (inter-token latency)</strong> measures each individual gap between two streamed chunks, instead of one average per request.</p>
<p>Most of the time ITL and TPOT are nearly identical. They split apart when:</p>
<ul>
<li><strong>A chunk carries several tokens.</strong> With speculative decoding, one streamed chunk can contain a few tokens at once.</li>
<li><strong>The stream stutters.</strong> A request with 298 fast gaps and one 2-second pause has a healthy TPOT but an ugly P99 ITL.</li>
</ul>
<p>Use TPOT to describe speed. Use ITL to catch stutter.</p>
<h2 id="3-end-to-end-latency-output-length-dominates">3. End-to-end latency: output length dominates</h2>
<p>Put the pieces together:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">End-to-end = TTFT + TPOT x (output tokens - 1)
</span></span><span class="line"><span class="cl">           = 300 ms + 25 ms x 299
</span></span><span class="line"><span class="cl">           = 7,775 ms
</span></span></code></pre></div><p>Look at the split. TTFT is 300 ms. Decoding is 7,475 ms.</p>
<p><strong>About 96% of the wait is the answer being written.</strong></p>
<p>That leads to two practical rules:</p>
<ul>
<li><strong>To make a chat feel faster, cut TTFT.</strong> Users forgive a long answer that starts immediately.</li>
<li><strong>To make a batch job or an agent faster, cut output tokens or TPOT.</strong> Asking for a shorter answer is often the cheapest optimization there is.</li>
</ul>
<p>It also means end-to-end latency is a poor number to compare across workloads. A request that returns 50 tokens will always beat one that returns 500, on any server.</p>
<h2 id="4-throughput-the-platforms-number">4. Throughput: the platform&rsquo;s number</h2>
<p><strong>Throughput is how much work the whole server finishes per second</strong>, summed across every user.</p>
<p>It usually comes in two flavors:</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Throughput</th>
            <th scope="col">Unit</th>
            <th scope="col">Answers</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Request throughput</td>
            <td>requests per second</td>
            <td>How many users can I serve?</td>
        </tr>
        <tr>
            <td>Token throughput</td>
            <td>tokens per second</td>
            <td>How much text does one GPU produce?</td>
        </tr>
    </tbody>
  </table>
</div>
<p>Here is the trap. A modern engine uses <a href="https://vishctl.dev/posts/why-vllm-is-dominating-ai-inference-market/">continuous batching</a>, so it generates tokens for many requests in the same step.</p>
<p>Say 32 users are streaming at once, and each sees 30 tokens per second:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">Per-user speed     = 30 tokens per second
</span></span><span class="line"><span class="cl">System throughput  = 32 x 30 = 960 tokens per second
</span></span></code></pre></div><p>Both numbers describe the same GPU at the same moment. A headline of &ldquo;960 tokens per second&rdquo; does not mean any single user gets 960. Nobody does.</p>
<p><strong>When you read a benchmark, always ask: is this per request or summed over all requests?</strong></p>
<h2 id="5-the-trade-off-you-cannot-max-out-both">5. The trade-off: you cannot max out both</h2>
<p>Batching more requests together raises throughput, but each request gets a smaller share of every step. So latency rises with load.</p>
<p>These numbers are invented to show the shape, not measured on real hardware:</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Concurrent requests</th>
            <th scope="col">System tokens per second</th>
            <th scope="col">Per-user TPOT</th>
            <th scope="col">TTFT</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>60</td>
            <td>17 ms</td>
            <td>150 ms</td>
        </tr>
        <tr>
            <td>8</td>
            <td>400</td>
            <td>20 ms</td>
            <td>180 ms</td>
        </tr>
        <tr>
            <td>32</td>
            <td>960</td>
            <td>33 ms</td>
            <td>300 ms</td>
        </tr>
        <tr>
            <td>64</td>
            <td>1,150</td>
            <td>56 ms</td>
            <td>900 ms</td>
        </tr>
        <tr>
            <td>128</td>
            <td>1,200</td>
            <td>107 ms</td>
            <td>6,000 ms</td>
        </tr>
    </tbody>
  </table>
</div>
<p>Read the last two rows carefully. Going from 64 to 128 users adds almost no throughput, while TTFT explodes. The GPU is full, so new requests wait in the queue.</p>
<figure class="mermaid-figure">
  <div class="mermaid">flowchart LR
    Z1["Idle<br/>fast but<br/>GPU wasted"] e1@--> Z2["Sweet spot<br/>busy GPU<br/>latency OK"]
    Z2 e2@--> Z3["Saturated<br/>throughput flat<br/>latency climbs"]
    Z3 e3@--> Z4["Overloaded<br/>queue grows<br/>TTFT explodes"]

    e1@{ animate: true }
    e2@{ animate: true }
    e3@{ animate: true }

    classDef idle fill:#101e27,stroke:#324950,color:#8aa0a8;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:3px;
    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    classDef router fill:#281d48,stroke:#a78bfa,color:#f1edff,stroke-width:2px;
    class Z1 idle;
    class Z2 gpu;
    class Z3 router;
    class Z4 warn;</div>
  <figcaption>As load rises, a server moves through four zones. The goal is to run in the second one, not the third.</figcaption>
</figure>

<p>So a single number never describes a server. A useful benchmark is a <strong>curve</strong>: latency plotted against load. The right operating point is the highest load where latency still fits your budget.</p>
<h2 id="6-percentiles-why-the-mean-lies">6. Percentiles: why the mean lies</h2>
<p>Latency is never one number. It is a spread, and the slow end is where users complain.</p>
<p>Take 100 requests. 99 of them have a 200 ms TTFT. One hits a full queue and takes 5,000 ms.</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Statistic</th>
            <th scope="col">Value</th>
            <th scope="col">What it tells you</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Mean</td>
            <td>248 ms</td>
            <td>Looks fine, hides the problem</td>
        </tr>
        <tr>
            <td>P50 (median)</td>
            <td>200 ms</td>
            <td>The typical request</td>
        </tr>
        <tr>
            <td>P99</td>
            <td>About 5,000 ms</td>
            <td>The slowest 1 in 100</td>
        </tr>
    </tbody>
  </table>
</div>
<p>&ldquo;P99 = 5 seconds&rdquo; means 1 request in 100 is at least that slow. That sounds rare until you remember that people send many requests.</p>
<p>A user who sends 20 messages in a session has this chance of hitting the slow tail at least once:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">1 - 0.99^20 = 18%
</span></span></code></pre></div><p>Nearly one in five sessions feels the P99. For an agent that makes 50 model calls per task, it is 39%. <strong>This is why serious latency targets are written as P95 or P99, never as an average.</strong></p>
<h2 id="7-goodput-throughput-that-actually-counts">7. Goodput: throughput that actually counts</h2>
<p>Throughput counts every finished request, even the ones that were painfully slow. <strong>Goodput</strong> counts only the requests that met your latency target.</p>
<p>First you set a target, called an <strong>SLO</strong> (service level objective). For example:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">SLO: TTFT under 500 ms  and  TPOT under 50 ms
</span></span></code></pre></div><p>Then you count only the requests that pass.</p>
<figure class="mermaid-figure">
  <div class="mermaid">flowchart LR
    IN["Server finishes<br/>10 requests<br/>per second"] g1@--> C["SLO check<br/>TTFT under 500 ms<br/>TPOT under 50 ms"]
    C g2@--> OK["6 pass<br/>goodput is 6"]
    C g3@--> BAD["4 too slow<br/>users gave up"]

    g1@{ animate: true }
    g2@{ animate: true }
    g3@{ animate: true }

    classDef input fill:#13264a,stroke:#38bdf8,color:#e6f6ff,stroke-width:2px;
    classDef router fill:#281d48,stroke:#a78bfa,color:#f1edff,stroke-width:2px;
    classDef gpu fill:#173f59,stroke:#22d3ee,color:#ecfeff,stroke-width:3px;
    classDef warn fill:#302410,stroke:#fbbf24,color:#fff3cf,stroke-width:2px;
    class IN input;
    class C router;
    class OK gpu;
    class BAD warn;</div>
  <figcaption>Ten requests per second finish, but only six meet the SLO. Throughput is 10. Goodput is 6.</figcaption>
</figure>

<p>Goodput is the honest way to compare two setups. Look back at the load table: at 128 concurrent requests throughput is the highest in the table, but with a 500 ms TTFT target the goodput is close to zero.</p>
<p>It also turns capacity planning into one question: <strong>what is the highest request rate where goodput still equals throughput?</strong> That rate is what one replica can really carry.</p>
<h2 id="try-it-measure-ttft-and-tpot-yourself">Try it: measure TTFT and TPOT yourself</h2>
<p>You do not need a benchmark suite to see these numbers. This script sends one streaming request and times it. It uses only the Python standard library.</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-python" data-lang="python"><span class="line"><span class="cl"><span class="ch">#!/usr/bin/env python3</span>
</span></span><span class="line"><span class="cl"><span class="s2">&#34;&#34;&#34;llm_clock.py: time one streaming request to an OpenAI-compatible API.&#34;&#34;&#34;</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">json</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">os</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">sys</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">time</span>
</span></span><span class="line"><span class="cl"><span class="kn">import</span> <span class="nn">urllib.request</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">base</span><span class="p">,</span> <span class="n">model</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="s2">&#34;/&#34;</span><span class="p">),</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">2</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="n">prompt</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">3</span><span class="p">]</span> <span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">3</span> <span class="k">else</span> <span class="s2">&#34;Explain a Kubernetes Pod in 150 words.&#34;</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">body</span> <span class="o">=</span> <span class="p">{</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;model&#34;</span><span class="p">:</span> <span class="n">model</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;messages&#34;</span><span class="p">:</span> <span class="p">[{</span><span class="s2">&#34;role&#34;</span><span class="p">:</span> <span class="s2">&#34;user&#34;</span><span class="p">,</span> <span class="s2">&#34;content&#34;</span><span class="p">:</span> <span class="n">prompt</span><span class="p">}],</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;stream&#34;</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;stream_options&#34;</span><span class="p">:</span> <span class="p">{</span><span class="s2">&#34;include_usage&#34;</span><span class="p">:</span> <span class="kc">True</span><span class="p">},</span>
</span></span><span class="line"><span class="cl">    <span class="s2">&#34;max_tokens&#34;</span><span class="p">:</span> <span class="mi">256</span><span class="p">,</span>
</span></span><span class="line"><span class="cl"><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="n">headers</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&#34;Content-Type&#34;</span><span class="p">:</span> <span class="s2">&#34;application/json&#34;</span><span class="p">}</span>
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;OPENAI_API_KEY&#34;</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">    <span class="n">headers</span><span class="p">[</span><span class="s2">&#34;Authorization&#34;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&#34;Bearer &#34;</span> <span class="o">+</span> <span class="n">os</span><span class="o">.</span><span class="n">environ</span><span class="p">[</span><span class="s2">&#34;OPENAI_API_KEY&#34;</span><span class="p">]</span>
</span></span><span class="line"><span class="cl"><span class="n">req</span> <span class="o">=</span> <span class="n">urllib</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">Request</span><span class="p">(</span><span class="n">base</span> <span class="o">+</span> <span class="s2">&#34;/v1/chat/completions&#34;</span><span class="p">,</span> <span class="n">json</span><span class="o">.</span><span class="n">dumps</span><span class="p">(</span><span class="n">body</span><span class="p">)</span><span class="o">.</span><span class="n">encode</span><span class="p">(),</span> <span class="n">headers</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">start</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">perf_counter</span><span class="p">()</span>
</span></span><span class="line"><span class="cl"><span class="n">first</span> <span class="o">=</span> <span class="n">last</span> <span class="o">=</span> <span class="kc">None</span>
</span></span><span class="line"><span class="cl"><span class="n">chunks</span><span class="p">,</span> <span class="n">exact_tokens</span> <span class="o">=</span> <span class="mi">0</span><span class="p">,</span> <span class="kc">None</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">with</span> <span class="n">urllib</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">urlopen</span><span class="p">(</span><span class="n">req</span><span class="p">)</span> <span class="k">as</span> <span class="n">resp</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="k">for</span> <span class="n">raw</span> <span class="ow">in</span> <span class="n">resp</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">        <span class="n">line</span> <span class="o">=</span> <span class="n">raw</span><span class="o">.</span><span class="n">decode</span><span class="p">()</span><span class="o">.</span><span class="n">strip</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">        <span class="k">if</span> <span class="ow">not</span> <span class="n">line</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s2">&#34;data:&#34;</span><span class="p">)</span> <span class="ow">or</span> <span class="n">line</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="s2">&#34;[DONE]&#34;</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">            <span class="k">continue</span>
</span></span><span class="line"><span class="cl">        <span class="n">event</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">line</span><span class="p">[</span><span class="mi">5</span><span class="p">:])</span>
</span></span><span class="line"><span class="cl">        <span class="k">if</span> <span class="n">event</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;usage&#34;</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">            <span class="n">exact_tokens</span> <span class="o">=</span> <span class="n">event</span><span class="p">[</span><span class="s2">&#34;usage&#34;</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;completion_tokens&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">        <span class="n">delta</span> <span class="o">=</span> <span class="p">(</span><span class="n">event</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;choices&#34;</span><span class="p">)</span> <span class="ow">or</span> <span class="p">[{}])[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;delta&#34;</span><span class="p">,</span> <span class="p">{})</span>
</span></span><span class="line"><span class="cl">        <span class="k">if</span> <span class="n">delta</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;content&#34;</span><span class="p">)</span> <span class="ow">or</span> <span class="n">delta</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&#34;reasoning_content&#34;</span><span class="p">):</span>
</span></span><span class="line"><span class="cl">            <span class="n">last</span> <span class="o">=</span> <span class="n">time</span><span class="o">.</span><span class="n">perf_counter</span><span class="p">()</span>
</span></span><span class="line"><span class="cl">            <span class="n">first</span> <span class="o">=</span> <span class="n">first</span> <span class="ow">or</span> <span class="n">last</span>
</span></span><span class="line"><span class="cl">            <span class="n">chunks</span> <span class="o">+=</span> <span class="mi">1</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="k">if</span> <span class="n">first</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span></span><span class="line"><span class="cl">    <span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="s2">&#34;No tokens were streamed back.&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl">
</span></span><span class="line"><span class="cl"><span class="n">tokens</span> <span class="o">=</span> <span class="n">exact_tokens</span> <span class="ow">or</span> <span class="n">chunks</span>
</span></span><span class="line"><span class="cl"><span class="n">ttft</span> <span class="o">=</span> <span class="n">first</span> <span class="o">-</span> <span class="n">start</span>
</span></span><span class="line"><span class="cl"><span class="n">e2e</span> <span class="o">=</span> <span class="n">last</span> <span class="o">-</span> <span class="n">start</span>
</span></span><span class="line"><span class="cl"><span class="n">tpot</span> <span class="o">=</span> <span class="p">(</span><span class="n">e2e</span> <span class="o">-</span> <span class="n">ttft</span><span class="p">)</span> <span class="o">/</span> <span class="nb">max</span><span class="p">(</span><span class="n">tokens</span> <span class="o">-</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&#34;Output tokens : </span><span class="si">{</span><span class="n">tokens</span><span class="si">}</span><span class="s2"> (</span><span class="si">{</span><span class="s1">&#39;reported by server&#39;</span> <span class="k">if</span> <span class="n">exact_tokens</span> <span class="k">else</span> <span class="s1">&#39;counted from chunks&#39;</span><span class="si">}</span><span class="s2">)&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&#34;TTFT          : </span><span class="si">{</span><span class="n">ttft</span> <span class="o">*</span> <span class="mi">1000</span><span class="si">:</span><span class="s2">8.1f</span><span class="si">}</span><span class="s2"> ms&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&#34;TPOT          : </span><span class="si">{</span><span class="n">tpot</span> <span class="o">*</span> <span class="mi">1000</span><span class="si">:</span><span class="s2">8.1f</span><span class="si">}</span><span class="s2"> ms  (</span><span class="si">{</span><span class="mi">1</span> <span class="o">/</span> <span class="n">tpot</span><span class="si">:</span><span class="s2">.1f</span><span class="si">}</span><span class="s2"> tokens per second)&#34;</span> <span class="k">if</span> <span class="n">tpot</span> <span class="k">else</span> <span class="s2">&#34;TPOT          : n/a&#34;</span><span class="p">)</span>
</span></span><span class="line"><span class="cl"><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s2">&#34;End-to-end    : </span><span class="si">{</span><span class="n">e2e</span> <span class="o">*</span> <span class="mi">1000</span><span class="si">:</span><span class="s2">8.1f</span><span class="si">}</span><span class="s2"> ms&#34;</span><span class="p">)</span>
</span></span></code></pre></div><p>Save it as <code>llm_clock.py</code> and point it at any server:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># vLLM or SGLang</span>
</span></span><span class="line"><span class="cl">python3 llm_clock.py http://localhost:8000 &lt;model-name&gt;
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># Ollama</span>
</span></span><span class="line"><span class="cl">python3 llm_clock.py http://localhost:11434 &lt;model-name&gt;
</span></span></code></pre></div><div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="c1"># LM Studio</span>
</span></span><span class="line"><span class="cl">python3 llm_clock.py http://localhost:1234 &lt;model-name&gt;
</span></span></code></pre></div><p>Three experiments make the theory concrete:</p>
<ol>
<li><strong>Run it twice with the same prompt.</strong> If the second TTFT is lower, you just saw prefix caching.</li>
<li><strong>Paste a very long prompt as the third argument.</strong> TTFT grows with it. TPOT barely moves.</li>
<li><strong>Run four copies at once.</strong> Per-request TPOT gets worse while the total tokens per second goes up. That is the trade-off from section 5.</li>
</ol>
<p>For experiment 3:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl"><span class="k">for</span> i in <span class="m">1</span> <span class="m">2</span> <span class="m">3</span> 4<span class="p">;</span> <span class="k">do</span> python3 llm_clock.py http://localhost:8000 &lt;model-name&gt; <span class="p">&amp;</span> <span class="k">done</span><span class="p">;</span> <span class="nb">wait</span>
</span></span></code></pre></div><p>No GPU nearby? The <a href="https://vishctl.dev/posts/simulate-gpu-vllm-llm-d-on-laptop/">laptop GPU simulation lab</a> runs a simulated vLLM whose latency you configure, so the script works there too.</p>
<h2 id="benchmark-properly-with-vllm-bench">Benchmark properly with vllm bench</h2>
<p>One request is a measurement. A benchmark needs many requests at a controlled rate. vLLM ships a load generator for this:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">vllm bench serve <span class="se">\
</span></span></span><span class="line"><span class="cl">  --backend vllm <span class="se">\
</span></span></span><span class="line"><span class="cl">  --model &lt;model-name&gt; <span class="se">\
</span></span></span><span class="line"><span class="cl">  --host 127.0.0.1 --port <span class="m">8000</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --endpoint /v1/completions <span class="se">\
</span></span></span><span class="line"><span class="cl">  --dataset-name random <span class="se">\
</span></span></span><span class="line"><span class="cl">  --random-input-len <span class="m">2000</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --random-output-len <span class="m">300</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --num-prompts <span class="m">200</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --request-rate <span class="m">4</span>
</span></span></code></pre></div><p>Flags change between releases, so check <code>vllm bench serve --help</code> for your version. The summary it prints maps directly onto this post:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">============ Serving Benchmark Result ============
</span></span><span class="line"><span class="cl">Successful requests:                     10
</span></span><span class="line"><span class="cl">Benchmark duration (s):                  5.78
</span></span><span class="line"><span class="cl">Request throughput (req/s):              1.73
</span></span><span class="line"><span class="cl">Output token throughput (tok/s):         382.89
</span></span><span class="line"><span class="cl">---------------Time to First Token----------------
</span></span><span class="line"><span class="cl">Mean TTFT (ms):                          71.54
</span></span><span class="line"><span class="cl">Median TTFT (ms):                        73.88
</span></span><span class="line"><span class="cl">P99 TTFT (ms):                           79.49
</span></span><span class="line"><span class="cl">-----Time per Output Token (excl. 1st token)------
</span></span><span class="line"><span class="cl">Mean TPOT (ms):                          7.91
</span></span><span class="line"><span class="cl">P99 TPOT (ms):                           8.03
</span></span><span class="line"><span class="cl">---------------Inter-token Latency----------------
</span></span><span class="line"><span class="cl">Mean ITL (ms):                           7.74
</span></span><span class="line"><span class="cl">P99 ITL (ms):                            8.39
</span></span><span class="line"><span class="cl">==================================================
</span></span></code></pre></div><p>That sample is trimmed from the <a href="https://docs.vllm.ai/en/latest/benchmarking/cli/">vLLM benchmark docs</a>. You can now read every line of it.</p>
<p>To build the latency curve from section 5, run it several times with a rising <code>--request-rate</code> (for example 1, 2, 4, 8, 16) and write down P99 TTFT and output token throughput for each run. The rate where P99 TTFT bends upward is your saturation point.</p>
<p>The same tool reports goodput. Pass your SLO in milliseconds and the summary gains a line for the requests per second that met it:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">vllm bench serve <span class="se">\
</span></span></span><span class="line"><span class="cl">  --model &lt;model-name&gt; <span class="se">\
</span></span></span><span class="line"><span class="cl">  --dataset-name random <span class="se">\
</span></span></span><span class="line"><span class="cl">  --num-prompts <span class="m">200</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --request-rate <span class="m">4</span> <span class="se">\
</span></span></span><span class="line"><span class="cl">  --goodput ttft:500 tpot:50
</span></span></code></pre></div><h2 id="watch-the-same-metrics-in-production">Watch the same metrics in production</h2>
<p>A benchmark tells you what a server can do. Production metrics tell you what it is doing. vLLM exposes these at <code>/metrics</code> in Prometheus format:</p>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">What you want to know</th>
            <th scope="col">vLLM metric</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>TTFT</td>
            <td><code>vllm:time_to_first_token_seconds</code></td>
        </tr>
        <tr>
            <td>Gap between tokens</td>
            <td><code>vllm:inter_token_latency_seconds</code></td>
        </tr>
        <tr>
            <td>End-to-end latency</td>
            <td><code>vllm:e2e_request_latency_seconds</code></td>
        </tr>
        <tr>
            <td>Time stuck in the queue</td>
            <td><code>vllm:request_queue_time_seconds</code></td>
        </tr>
        <tr>
            <td>Requests being served now</td>
            <td><code>vllm:num_requests_running</code></td>
        </tr>
        <tr>
            <td>Requests waiting for a slot</td>
            <td><code>vllm:num_requests_waiting</code></td>
        </tr>
        <tr>
            <td>How full the KV cache is</td>
            <td><code>vllm:kv_cache_usage_perc</code></td>
        </tr>
    </tbody>
  </table>
</div>
<p>Peek at them with one command:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">curl -s http://localhost:8000/metrics <span class="p">|</span> grep -E <span class="s2">&#34;time_to_first_token|num_requests_(running|waiting)&#34;</span>
</span></span></code></pre></div><p>The latency metrics are histograms, so percentiles come from a query. P99 TTFT over the last five minutes:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">histogram_quantile(0.99, sum by (le) (rate(vllm:time_to_first_token_seconds_bucket[5m])))
</span></span></code></pre></div><p>If you only alert on one thing, make it <code>vllm:num_requests_waiting</code>. A queue that stays above zero is the earliest sign that you have entered the saturated zone.</p>
<p>For the full set of panels and alert rules, see <a href="https://vishctl.dev/posts/monitoring-vllm-prometheus-dashboard-alerts/">Monitoring vLLM in Production</a>.</p>
<h2 id="which-knob-moves-which-metric">Which knob moves which metric</h2>
<div class="table-scroll">
  <table>
    <thead>
        <tr>
            <th scope="col">Symptom</th>
            <th scope="col">Likely cause</th>
            <th scope="col">What helps</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>High TTFT, empty queue</td>
            <td>Long prompts being prefilled every time</td>
            <td>Prefix caching, <a href="https://vishctl.dev/posts/why-lmcache-is-needed/">LMCache</a>, stable prompt prefixes</td>
        </tr>
        <tr>
            <td>High TTFT, growing queue</td>
            <td>Not enough capacity</td>
            <td>More replicas, autoscale on queue depth</td>
        </tr>
        <tr>
            <td>High TTFT on some replicas only</td>
            <td>Requests land where the cache is cold</td>
            <td>Cache-aware routing with <a href="https://vishctl.dev/posts/llm-d-kubernetes-inference-routing/">llm-d</a></td>
        </tr>
        <tr>
            <td>High TPOT for everyone</td>
            <td>Batch too large, or a noisy neighbor on a <a href="https://vishctl.dev/posts/kubernetes-gpu-sharing-time-slicing-mps-mig/">shared GPU</a></td>
            <td>Cap concurrency, isolate the GPU</td>
        </tr>
        <tr>
            <td>Good TPOT, ugly P99 ITL</td>
            <td>Stutter from long prefills in the same batch</td>
            <td>Separate long-prompt traffic, or disaggregate prefill and decode</td>
        </tr>
        <tr>
            <td>Slow strict-JSON answers</td>
            <td>Token-by-token constrained decoding</td>
            <td>An engine with jump-forward decoding, see <a href="https://vishctl.dev/posts/sglang-vs-vllm/">SGLang vs. vLLM</a></td>
        </tr>
    </tbody>
  </table>
</div>
<h2 id="cheat-sheet">Cheat sheet</h2>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-text" data-lang="text"><span class="line"><span class="cl">TTFT              = time to first token: network + queue + prefill
</span></span><span class="line"><span class="cl">TPOT              = time per output token: (end-to-end - TTFT) / (output tokens - 1)
</span></span><span class="line"><span class="cl">ITL               = inter-token latency: the gap between two streamed chunks
</span></span><span class="line"><span class="cl">End-to-end        = TTFT + TPOT x (output tokens - 1); dominated by answer length
</span></span><span class="line"><span class="cl">Tokens per second = 1000 / TPOT in ms for one user; summed over all users for a system
</span></span><span class="line"><span class="cl">Throughput        = total requests or tokens finished per second, across everyone
</span></span><span class="line"><span class="cl">P50 / P99         = the typical request / the slowest 1 in 100
</span></span><span class="line"><span class="cl">SLO               = the latency target you promise, such as P99 TTFT under 500 ms
</span></span><span class="line"><span class="cl">Goodput           = requests per second that met the SLO
</span></span><span class="line"><span class="cl">Saturation point  = the load where throughput stops rising and latency takes off
</span></span><span class="line"><span class="cl">Queue depth       = requests waiting for a slot; the earliest warning sign
</span></span><span class="line"><span class="cl">Rule of thumb     = chat cares about TTFT, agents and batch care about TPOT and output length
</span></span></code></pre></div><p>To see what makes TTFT drop, read <a href="https://vishctl.dev/posts/why-lmcache-is-needed/">Why LMCache Exists</a> and the <a href="https://vishctl.dev/posts/llm-d-kubernetes-inference-routing/">llm-d routing guide</a>. To see what continuous batching does to throughput, read <a href="https://vishctl.dev/posts/why-vllm-is-dominating-ai-inference-market/">Why vLLM Is Dominating the AI Inference Market</a>.</p>
]]></content:encoded></item></channel></rss>