THUDM / THUDM/slime

请求支持 rollout 粒度的 sglang 请求路由提高多轮 rollout 的吞吐量

Open
#1,469 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.5k
Forks
1.3k
Avg merge
5h 36m
Merged PRs (30d)
22

Description

在进行超多轮 agent rollouts 的过程中,由于router是按照请求进行路由的,导致prefix-cache 的命中率可能较低。

url = f"http://{args.sglang_router_ip}:{args.sglang_router_port}/generate"

由于 router 采用的是 逐请求(per-request)的负载均衡策略,同一个 rollout trajectory 中的多个请求(通常共享较长的前缀)可能会被路由到不同的推理引擎实例上。这会破坏 prefix-cache 的局部性,导致相同前缀被多次重复 prefill,从而在多轮长序列 rollouts 场景下显著降低整体吞吐。

因此想请教,是否可以支持一种 rollout 级别的请求黏性(request affinity)机制,例如:

  • 在 rollout / trajectory 级别将请求绑定到某一个固定的推理引擎实例;
  • 在多轮 rollouts 过程中保持 prefix-cache 的局部性与稳定命中;
  • 负载均衡发生在“rollout → 推理引擎实例”的分配阶段,而不是在每一次 generate 请求上通过 router 进行动态路由。

十分感谢回复

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Python entry point that constructs the /generate URL and trace how the sglang router performs per-request routing. Define the rollout or trajectory boundary and evaluate how routing can preserve engine affinity; done means multi-round requests from one rollout stay associated with an inference instance while load balancing still occurs across rollouts and prefix-cache locality improves.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, distributed-systems, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.