[Scheduler] Cap prefill-delayer queue target by admission capacity (#35191)

This commit is contained in:
paulzhang-tm
2026-08-18 21:40:13 +08:00
committed by GitHub
parent 94eef833fe
commit 0065fbfae1
3 changed files with 40 additions and 4 deletions
@@ -95,6 +95,7 @@ class PrefillDelayer:
if self._max_delay_ms is None:
self._max_delay_ms = 5000.0
self._queue_trigger_enabled = self._queue_min_ratio is not None
self._prefill_max_requests = server_args.prefill_max_requests
logger.info(
f"PrefillDelayer initialized with "
f"max_delay_passes={self._max_delay_passes} "
@@ -250,9 +251,14 @@ class PrefillDelayer:
# and fragment prefill into many tiny batches.
queue_condition = False
if self._queue_trigger_enabled and global_running_batch_max > 0:
queue_capacity = (
self._prefill_max_requests
if self._prefill_max_requests is not None
else global_max_prefill_bs_max
)
queue_min_effective = min(
int(global_running_batch_max * self._queue_min_ratio),
global_max_prefill_bs_max,
queue_capacity,
)
queue_condition = (
queue_min_effective > 0
+3 -3
View File
@@ -3356,9 +3356,9 @@ class ServerArgs:
(
"Opt-in to the adaptive queue-based delay trigger (independent of the "
"slot-based one). Delays prefill until the waiting queue reaches "
"min(running_req * ratio, max_prefill_bs) so small fragments batch "
"into a larger prefill. Unset (default) keeps the original slot-only "
"behavior. Typical: 0.1 ~ 0.5."
"min(running_req * ratio, prefill_max_requests), falling back to the "
"observed max_prefill_bs when no request limit is set. Unset (default) "
"keeps the original slot-only behavior. Typical: 0.1 ~ 0.5."
),
NS("schedule"),
] = None