Repository navigation
Add DPRequestRouter and use it in generator - #3768
Conversation
| else: | ||
| # TODO: investigate whether token length is the optimial property | ||
| # for load estimation. | ||
| estimated_cost = len(request.prompt_token_ids) |
There was a problem hiding this comment.
Is it better to use request count here?
There was a problem hiding this comment.
request count sounds better, as prompt length only represents prefill work?
Related:
@yichuan-w also complained that by default combining group_id + sample_idx as routing session id makes it less efficient for prefix cache sharing. He said in reality every generator is saturated anyway. cc @felipemello1
There was a problem hiding this comment.
Sorry, i want to make sure i understand it. Is the complaint that we route based on the rollout, but not the group?
There was a problem hiding this comment.
@felipemello1 correct. Context is that the task has many groups to rollout, so no worries on load imbalance (aka some generator idle)
There was a problem hiding this comment.
the motivation to route on the rollout_id instead of the group_id is not to reduce generator idle time.
It is that the generator may be too busy to process ALL requests at once.
Say we have N=32, and the generator can process 31. Say that it takes T time to process one request on average. Now, this entire group will take 2*T to be processed, instead of T, because it has to process 31, and only then process the 32nd
Worse: say the generator can process 15 at a time. Now it will take 3T to finish all 32..
However, if we spread the requests, we have a better chance of making sure that all 32 are computed in parallel, and finish together -- no stragglers. Does this make sense?
There was a problem hiding this comment.
the generator can process 31
This is made up, right? Continuous batching would continuously process requests.
Also what we care is E2E time, which potentially includes many groups of N=32.
There was a problem hiding this comment.
would continuously process requests.
We add the request, but vllm will compute based on capacity. We can add 1M requests. They wont be processed in parallel. In fact, if kvcache grows, inflight requests will be requeued to make room.
There was a problem hiding this comment.
thats what i mean by my example, say theres capacity for 31 -- the 32nd will stay in the queue
There was a problem hiding this comment.
but, i mean, i am not dying on this hill. Its fine to change back to group and we can empirically check which is faster when we push for better perf.
There was a problem hiding this comment.
Not sure if this makes things too complicated:
we could add a fail-over parameter to StickySessionStrategy, and pass both group_id and rollout_id into it. Then:
- the strategy put requests with the same
group_idinto 1 generator/DP until that generator/DP hits the fail-over parameter. Then - assign a new generator/DP.
The the strategy's dict's key will be (group_id, rollout_id).
Anyway, I think it might be helpful to have some data in production runs to see which direction we want to optimize for.
| else: | ||
| # TODO: investigate whether token length is the optimial property | ||
| # for load estimation. | ||
| estimated_cost = len(request.prompt_token_ids) |
There was a problem hiding this comment.
request count sounds better, as prompt length only represents prefill work?
Related:
@yichuan-w also complained that by default combining group_id + sample_idx as routing session id makes it less efficient for prefix cache sharing. He said in reality every generator is saturated anyway. cc @felipemello1
| """Caller-defined reserved load on this DP rank.""" | ||
|
|
||
|
|
||
| class DPRequestRouter: |
There was a problem hiding this comment.
nit on naming:
- In
GeneratorRouter, generator is routing candidate, where we are routing request. - In
DPRequestRouter, request is what we route
Do you think we could rename to
- InterGenerator(Request)Router
- IntraGenerator(Request)Router
which also reflects our 2-layer routing design. Request is optional depending on how long you want it to be.
There was a problem hiding this comment.
I used InterGeneratorRouter and IntraGeneratoRouter. It is a little long, but I think it reflects the 2-layer routing explicitly.
7a810ec to
e2e1281
Compare
| # Load is measured as in-flight request count (one unit per call). | ||
| routing_ctx=RoutingContext( | ||
| estimated_cost=len(prompt_token_ids), | ||
| estimated_cost=1, |
There was a problem hiding this comment.
since we use request count for DP routing, maybe we should use request count for inter-generator routing too?
| ) | ||
| """Parallelism configuration for the vLLM engine.""" | ||
|
|
||
| dp_routing_strategy: RoutingStrategy.Config = field( |
There was a problem hiding this comment.
should be part of RequestDispatcher.Config (or even IntraGeneratorRouter.Config, to be symmetric to InterGeneratorRouter), not Generator.Config
e2e1281 to
10c3bb8
Compare
Note: the first 2 comments are submitted in it own PR in #3765. Review that first. For this PR, only review the commits after that.
This PR adds a
DPRequestRouter, and use it in generator DP routing. It does a refactoring ongenerator_router.py, so the routing strategy classes, such asStickySessionRoutingStrategycan be shared.TODO: Currently
StickySessionRoutingStrategywill not re-route a sticky session even if the assigned DP or generator is overloaded. We should add a fail-over policy to address that. But that is not in the scope of this PR.