⚡闪卡盲测➔
L2S1 · 商业 ROIS5 · 评测与观测S6 · 安全与成本Verified: 2026-11-30

L2 系统设计 · 分布式 vLLM/SGLang Prefill-Decode 分离推理与 KV 路由架构

对标 AI Infra / Inference Engineer 终面核心题:拆解长上下文高并发下的计算瓶颈(Compute-Bound Prefill)与显存带宽瓶颈(Memory-Bandwidth-Bound Decode)相互干扰问题,设计 P/D 分离集群、RDMA/NVLink KV Cache 传输、Radix 前缀亲和路由与分级成本 FinOps 调度。

适用场景 (Best For)

冲刺 OpenAI / Anthropic / Databricks / Anyscale / Fireworks / NVIDIA AI Infra 与推理系统架构师面试。

人机边界 (Human-AI Boundary)

推理网关根据租户 SLA 优先级、队列深度与缓存亲和自动路由降级;容量规划、多区域 GPU 配额上限及异常熔断策略由 SRE/Infra 工程师审定。

常见反模式与避坑 (Anti-Patterns)

  • Co-locating 32k-token prefill bursts and latency-sensitive decode batches on the same replica without chunked-prefill or P/D isolation, causing severe ITL spikes
  • Using blind round-robin load balancing across LLM replicas, thrashing Radix/Prefix KV caches down to <5% hit rate

延迟成本与评测门禁

TTFT <= 350ms (8k prompt on Prefill pool); Inter-Token Latency (TPOT) <= 25ms P99 on Decode pool · H100/B200 GPU-hours + InfiniBand/RoCEv2 KV transfer overhead (offset by 3x higher decode batch utilization)

  • SLO-Compliant Goodput (Tokens/s/GPU meeting TTFT & TPOT): TTFT P99 < 400ms & TPOT P99 < 30ms at >= 75% GPU HBM KV utilization (Benchmark under mixed realistic length distributions (short chat + 32k RAG/coding bursts))
  • Prefix Cache Hit Rate & KV Transfer Overhead: KV prefix hit >= 65% on agentic/system-prompt workloads; KV migration < 15% of TTFT (Measure RDMA/NIXL transfer latency across cross-node Decode handoffs)

💰 商业 ROI 模型与证据等级

verified_benchmark

P/D 分离消除长输入 Prefill 对生成流式卡顿的尾延迟冲击,在严格满足 TTFT/TPOT 双重 SLA 下将单百万 Token 推理 GPU 成本降低 30%–45%(Goodput 显著提升)。

🏗️ 端到端系统架构流水线

Step 1: 前缀感知网关与租户令牌桶熔断调度

网关按最长公共前缀哈希(Consistent Hashing + Load Shedding)将请求优先路由到已热缓存相同 System/Repo 前缀的 Prefill 节点。

Step 2: Prefill 计算节点 ➔ 异步 RDMA KV 传输 ➔ Decode 连续批处理池

Prefill 节点算完首 Token 并立即通过 RDMA/NVLink 将 Paged KV Blocks 推送到目标 Decode 节点,Decode 池以大 Batch 稳定吐字。

⚖️ 工程选型与架构权衡矩阵

Disaggregated Prefill + Decode Pools (RDMA Interconnect)
适用条件:长上下文(>8k Input)与高并发流式输出并存、且集群具备高速 InfiniBand/RoCE 互联的生产场景。
核心权衡:彻底隔离算力与显存带宽争抢并独立扩缩容;对网络带宽与分布式调度复杂度要求高。
Co-Located Chunked Prefill + PagedAttention
适用条件:中等规模部署、无高速跨机 RDMA 或输入输出长度较短的通用对话。
核心权衡:部署简单零 KV 跨机传输开销,高长文突发下 Decode 尾延迟仍会受轻微抖动影响。

📊 同类技术选型与基准对比

  • P/D Disaggregation vs Monolithic Continuous Batching (32k input / 512 output mix): cuts P99 TPOT jitter by ~3.2x at 2x concurrency.

🚨 生产失效模式与可观测特征

  • Hot-prefix thundering herd overloading one Prefill replica if consistent hashing lacks bounded load shedding
  • KV cache transfer backpressure stalling Prefill HBM reclamation when Decode pool saturates

🛡️ 合规边界与治理硬约束

  • Strict tenant isolation on shared Radix/Paged KV memory blocks (zero cross-tenant KV cache reuse unless explicitly public system prefix)
  • Cryptographic zeroing/invalidation of freed KV memory blocks in regulated multi-tenant clusters

🎤 面试高频追问与架构答辩题

  1. When does Prefill-Decode disaggregation actually perform WORSE than Chunked Prefill on the same node (hint: compute KV-transfer time vs prompt length over Ethernet vs InfiniBand)?
⚡
想检验本题的肌肉记忆?进入 3 阶闪卡主动回忆盲测
隐藏答案遮罩,自测:审题锚点 ➔ 数理公式机理 ➔ 工业标杆代码与连环追问。3 分钟攻破认知盲区!
🎯 立即在闪卡中盲测此题➔

上下游关联知识链路

[L3] vLLM / SGLang 投机解码、前缀缓存与 PD 分离推理压测平台(实战项目)[HubB] 岗位能力透镜 · AI 推理优化工程师 (AI Inference Engineer)[HubB] 岗位能力透镜 · AI 研究科学家 (Research Scientist)[L0 Card] vLLM PagedAttention 与连续批处理[L0 Card] Prompt Caching/RadixAttention[L0] vLLM PagedAttention 与连续批处理推理引擎[L0] SGLang RadixAttention 自动前缀复用与零拷贝调度引擎[L0] 大小模型置信度级联路由与成本-质量帕累托网关原语[L0] 大模型 Token FinOps、前缀缓存与语义缓存网关原语[L1] Stage 6 · KV Prefix 对齐与 Prompt Caching 推理加速降本模式[L1] Stage 6 · SaaS 多租户 Token 预算限流与渐进式降级熔断模式[L1] Stage 6 · 语义缓存与分层级联模型路由(FinOps Cost-SLA)模式

站内交互工具与信源依据