fix: fixed Planner division by zero errors in sglang backend #3113
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.
Overview:
Fixes division by zero errors in planner's autoscaling logic that prevented scaling decisions in disaggregated SGLang deployments.
Details:
currently Three division by zero scenarios in
planner_core.py:make_adjustments()
:Line 375:
self.p_correction_factor = self.last_metrics.ttft / expect_ttft
expect_ttft = 0
from interpolation edge casesLine 384:
self.d_correction_factor = self.last_metrics.itl / expect_itl
expect_itl = 0
from interpolation edge casesLine 379:
concurrency = self.last_metrics.num_req / len(self.d_endpoints)
len(self.d_endpoints) = 0
(no decode workers initially)components/planner/src/dynamo/planner/utils/planner_core.py
1. TTFT Correction Factor (lines 375-379):
Where should the reviewer start?
components/planner/src/dynamo/planner/utils/planner_core.py
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)