feat(pd): add adaptive cache-aware admission control - #1529
Open
sufubao wants to merge 8 commits into
Open
Conversation
sufubao
force-pushed
the
feat/pd-cache-aware-admission
branch
from
August 31, 2026 12:11
93312ef to
b915415
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
这个 PR 将 PD Master 原先基于进行中请求数的静态阈值,改为一个真实、有界、可取消的缓存感知准入队列。目标不是单纯放大容量,而是在以下三件事之间形成闭环:
准入模型
请求在派发到 P/D 节点前分为三类:
CONTINUATION:携带X-Session-Id,且服务端在 TTL 内已经观察到同一 Session 成功返回过结果。PROBABLE_CACHE_HIT:前缀树预估缓存命中率达到阈值。COLD:没有已确认 Session,也没有足够的预估缓存复用。队列使用 8:3:1 的加权轮转,优先保护连续会话,同时为低优先级请求保留进展机会。同一 Session 严格串行并保持 FIFO;高优先级请求可在队列满时替换低优先级请求。
自动调节
1.5D/2D阈值。n个 choice 原子占用n个 Decode 槽位,避免单个用户请求绕过容量限制。多 Master 容量安全
每个 P/D 节点根据当前 PD Master 集合,将
running_max_req_size确定性切分为互不重叠的容量租约,并随心跳上报租约 epoch。Master 集合变化时会立即唤醒心跳重新上报,旧 epoch 不会覆盖新租约,避免多个 Master 重复计算同一份 Decode 容量。生命周期与可观测性
边界
本 PR 只调整 Master 准入和控制面遥测,不修改底层 Radix cache 的驱逐策略。Probationary/Protected 分段等缓存内部策略留给后续独立 PR。
测试
88 项测试通过;同时通过
git diff --check、新准入模块 Flake8 检查和指标注册验证。本次未运行 benchmark / performance experiment。