Dashboard: time to first token tile and chart
vLLM: from the vllm:time_to_first_token_seconds histogram. MLX: the proxy times streamed requests from arrival to the first generated token. Each chart sample is the average over requests that got their first token in that 2 s window; idle samples are gaps, and isolated samples now draw as dots in every chart. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QaE1hpvyZTJixEbUUMj9Ca
This commit is contained in:
parent
8611d92cf4
commit
994659b5e2
3 changed files with 50 additions and 8 deletions
|
|
@ -62,6 +62,8 @@ def parse_vllm_metrics(text):
|
|||
"spec_accepted": vals.get("vllm:spec_decode_num_accepted_tokens_total"),
|
||||
"spec_drafted": vals.get("vllm:spec_decode_num_draft_tokens_total"),
|
||||
"preemptions": vals.get("vllm:num_preemptions_total"),
|
||||
"ttft_sum": vals.get("vllm:time_to_first_token_seconds_sum"),
|
||||
"ttft_count": vals.get("vllm:time_to_first_token_seconds_count"),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -75,6 +77,7 @@ class Sampler:
|
|||
self.state = {}
|
||||
self.action = None
|
||||
self._dl_cache = (0, {})
|
||||
self.last_ttft = None # (time, seconds) of the latest sample with new first tokens
|
||||
|
||||
def reload_cfg(self):
|
||||
self.cfg = paths.load_config() or self.cfg
|
||||
|
|
@ -128,19 +131,26 @@ class Sampler:
|
|||
else:
|
||||
phase = "loading"
|
||||
|
||||
gen_rate = prompt_rate = None
|
||||
gen_rate = prompt_rate = ttft = None
|
||||
if metrics.get("gen_total") is not None and self.prev:
|
||||
pt, pm = self.prev
|
||||
dt = now - pt
|
||||
if dt > 0 and pm.get("gen_total") is not None:
|
||||
gen_rate = max(metrics["gen_total"] - pm["gen_total"], 0) / dt
|
||||
prompt_rate = max((metrics.get("prompt_total") or 0) - (pm.get("prompt_total") or 0), 0) / dt
|
||||
# Average time to first token of the requests that got their first token since the
|
||||
# last sample (none: no point, so the chart shows a gap rather than a stale value).
|
||||
dn = (metrics.get("ttft_count") or 0) - (pm.get("ttft_count") or 0)
|
||||
if dn > 0:
|
||||
ttft = max((metrics.get("ttft_sum") or 0) - (pm.get("ttft_sum") or 0), 0) / dn
|
||||
if ttft is not None:
|
||||
self.last_ttft = (now, ttft)
|
||||
self.prev = (now, metrics) if metrics else None
|
||||
|
||||
gpu = hw.live_stats(cfg["kind"])
|
||||
kv = metrics.get("kv")
|
||||
point = {
|
||||
"t": now, "gen": gen_rate, "prompt": prompt_rate,
|
||||
"t": now, "gen": gen_rate, "prompt": prompt_rate, "ttft": ttft,
|
||||
"kv": kv * 100 if kv is not None else None,
|
||||
"util": gpu["util"] if gpu else None,
|
||||
"temp": gpu["temp"] if gpu else None,
|
||||
|
|
@ -176,6 +186,10 @@ class Sampler:
|
|||
"prefix_hit": ratio("prefix_hits", "prefix_queries"),
|
||||
"spec_accept": ratio("spec_accepted", "spec_drafted"),
|
||||
"preemptions": metrics.get("preemptions"),
|
||||
"ttft_last": self.last_ttft[1] if self.last_ttft else None,
|
||||
"ttft_last_t": self.last_ttft[0] if self.last_ttft else None,
|
||||
"ttft_avg": ratio("ttft_sum", "ttft_count"),
|
||||
"ttft_count": metrics.get("ttft_count"),
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue