docs(kvc): replace v2 path breakdown tables with generated figures

V2_DEEP_ANALYSIS §3.1 (execution_mode distribution) and §3.2 (path-level
latency vs DP) had hand-typed tables with approximate latencies (e.g.
"~1.0s") and required readers to mentally compare 5+ rows × 5 columns.
Both sections now reference generated PNG figures derived directly from
the v2 + DP metrics.jsonl files.

§3.1 figure (v2_execution_mode_distribution.png):
  Horizontal bar chart, log x-axis. 4076 direct-to-D fast-path requests
  (green) dwarf the rest by ~30x; the long tail of slow / fallback /
  failure modes is visible at one glance. Counts and percentages
  annotated on each bar.

§3.2 figure (v2_path_level_latency.png):
  Grouped bar chart, log y-axis. Per-path TTFT p50 / TTFT p99 / Lat p50
  with exact numeric labels (no more "~1.0s" approximations). Sample
  counts annotated below each path. Quick visual reads:
   - KVC fast path TTFT p50 41ms vs DP 92ms (2.2x faster)
   - KVC reseed TTFT p99 5.12s vs DP 0.43s (12x slower) -- the cost
   - KVC no-d-capacity TTFT p99 7.65s (worst case)

Bundled:
- scripts/analysis/plot_v2_path_breakdown.py -- the script that
  generates both figures; rerunable when v2 data changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kzlin
2026-05-11 17:38:43 +08:00
parent 37e9caa431
commit b5af19583b
4 changed files with 234 additions and 20 deletions

View File

@@ -187,31 +187,22 @@ v2 整体跑得快不仅因为 "KVC 机制好",更因为 **91.6% 请求被路
### 3.1 v2 内部 execution_mode 分布
```
kvcache-direct-to-d-session 4076 (91.6%) ← 快路径
pd-router-d-session-reseed 150 (3.4%) ← 慢路径mooncake reseed
pd-router-fallback-session-not-resident-session-cap 50 (1.1%)
pd-router-fallback-session-not-resident-seed-filter-early-turn 52 (1.2%)
pd-router-turn1-seed 52 (1.2%)
pd-router-fallback-no-d-capacity 31 (0.7%)
pd-router-fallback-real-large-append-session-cap 25 (0.6%)
其余 ~13 (<0.3%)
```
![KVC v2 execution_mode 分布](figures/v2_execution_mode_distribution.png)
数据来源:`outputs/qwen3-30b-tp1-ts1-migration-v2/kvc_1p3d_migration_v2_run1_metrics.jsonl`n = 4449全部请求含失败。绿色 = direct-to-D 快路径 = 91.6%;其余红色 = 慢路径 / fallback / 失败。绘图脚本:`scripts/analysis/plot_v2_path_breakdown.py`
### 3.2 path-level 延迟 vs DP
| Path | n | 占比 | TTFT P50 | TTFT P99 | Lat P50 |
|---|---:|---:|---:|---:|---:|
| KVC `direct-to-d-session` | 4076 | 91.6% | **42ms** | 89ms | 0.470s |
| KVC `d-session-reseed` | 150 | 3.4% | ~1.0s | 7.51s | ~2.5s |
| KVC `no-d-capacity` fallback | 31 | 0.7% | ~1.0s | 7.66s | ~3.0s |
| KVC `session-not-resident-*` | 102 | 2.3% | 0.3-2.3s | | 1-3s |
| DP `dp-colo-router` | 4449 | 100% | 90ms | **427ms** | 0.659s |
![Path-level latency: KVC v2 各路径 vs DP](figures/v2_path_level_latency.png)
数据来源:同上 + `outputs/qwen3-30b-tp1-ts1-validation/dp4_metrics.jsonl`。Y 轴 log 刻度latency 跨度 41ms ~ 7.71s)。已过滤 abort / error 请求,所有数字按对等口径计算。
**关键事实**
- KVC 的 91.6% fast path 在 TTFT 上确实碾压 DP42ms vs 90ms
- KVC 的 8.4% slow path 比 DP 慢 7-17 倍1-7s vs 0.4s
- DP **没有 slow path**——每个请求在本地 worker 完整 prefill最坏情况也是 P99 8s 量级
- KVC 的 91.6% **fast path** 在 TTFT p50 上是 **41ms vs DP 92ms**——压制 DP 2.2×TTFT p99 150ms vs DP 428ms 仍优 2.9×
- KVC 的 **3.4% reseed 慢路径** TTFT p99 = **5.12s**,是 DP 单一路径 p99428ms**12×**
- KVC 的 **0.7% no-d-capacity fallback** 是最坏情况TTFT p99 = 7.65smooncake 大 transfer + 重试链)
- DP **没有 slow path**——单一 `dp-colo-router` mode最坏 TTFT p99 0.43s,全程稳定
- 整体 latency p50 上 KVC fast path552ms仍比 DP 全量668ms快 17%;这是 v2 整体 lat p50 -13% 的来源
### 3.3 Fast path 的工作量比 DP 少 6.9× —— 不是 mechanism 更快

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB