执行摘要
暴露 sglang 负载 inflight 细节
当前 /v1/loads 端点仅返回聚合统计数据,运维人员难以定位请求堆积或卡死问题。暴露 inflight 细节可帮助排查请求级瓶颈。
建议运维团队关注该能力,可用于请求生命周期分析和调度调优。设计上请求触发采集,性能影响可控。
本 PR 无公开 review 评论。
当前 /v1/loads 端点仅返回聚合统计数据,运维人员难以定位请求堆积或卡死问题。暴露 inflight 细节可帮助排查请求级瓶颈。
建议运维团队关注该能力,可用于请求生命周期分析和调度调优。设计上请求触发采集,性能影响可控。
本 PR 无公开 review 评论。
| 文件 | 模块 | 状态 | 重要度 |
|---|---|---|---|
docker/patch/latest/sglang.patch |
推理引擎 | modified | 6.92 |
docker/version.txt |
部署脚本 | modified | 1.72 |
docker/patch/latest/sglang.patch
observability
核心变更:修改 sglang 源码增加 inflight 监控
# GetLoadsReqInput 中新增 inflight 枚举值
VALID_SECTIONS = frozenset({
"core", "memory", "spec", "lora", "disagg", "queues",
"inflight", # 新增:请求级队列明细
"all"
})
# GetLoadsReqOutput 中新增 inflight 字段
@dataclass
class GetLoadsReqOutput(BaseReq):
core: Optional[CoreMetrics] = None
memory: Optional[MemoryMetrics] = None
spec: Optional[SpecMetrics] = None
lora: Optional[LoRAMetrics] = None
disaggregation: Optional[DisaggregationMetrics] = None
queues: Optional[QueueMetrics] = None
# 请求级队列明细,仅当 include 包含 "inflight" 或 "all" 时填充
# 每个元素为 {"name": str, "num_reqs": int, "reqs": List[Dict]}
# reqs 中的字典包含 rid、bootstrap_room、seqlen、age_s、stage 等字段
inflight: Optional[List[Dict[str, Any]]] = None
# SchedulerMetricsMixin 中 inflight 数据采集(部分)
if include_all or "inflight" in include:
now_perf = time.perf_counter()
inflight_queues = [
("running", self.running_batch.reqs, None),
]
if self.disaggregation_mode == DisaggregationMode.PREFILL:
inflight_queues += [
("waiting", self.waiting_queue, "wait_queue_entry_time"),
("bootstrap", self.disagg_prefill_bootstrap_queue.queue, "prefill_queue_entry_time"),
]
inflight = []
for name, req_list, entry_time_field in inflight_queues:
reqs_detail = []
for req in req_list:
age_s = now_perf - getattr(req.time_stats, entry_time_field, now_perf)
reqs_detail.append({
"rid": req.rid,
"age_s": age_s,
"stage": req.stage if hasattr(req, 'stage') else None,
# ... 其他字段
})
inflight.append({"name": name, "num_reqs": len(reqs_detail), "reqs": reqs_detail})
output.inflight = inflight or None
当前评论区没有形成足够清晰的争议点或结论,后续有更多讨论时会体现在这里。
用户可通过 ?include=inflight 参数获取更细粒度的请求状态,提升运维可观测性。影响范围限于使用更新后 Docker 镜像的部署。
当前没有检测到明确关联的 Issue 链接,后续同步到相关引用后会出现在这里。
参与讨论