[Core] Performance fix for orchestrator bottleneck: separates inter-stage from client outputs (#4527)

Signed-off-by: yinpeiqi <yinpeiqi809@gmail.com>
Co-authored-by: Chenguang ZHENG <645327136@qq.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
Co-authored-by: Gao Han <hgaoaf@connect.ust.hk>
This commit is contained in:
authored and GitHub committed 2026-06-29 17:43:36 +02:00
1 parent 724f5d132d
commit 504698dec8
24 files changed
+672 -66

No files matched your search

+20
View File
@@ -44,6 +44,7 @@ from vllm_omni.engine.messages import (
StageSubmissionMessage,
UnregisterRemoteReplicaMessage,
)
from vllm_omni.engine.orchestrator_monitor import create_orch_monitor, replica_key
from vllm_omni.engine.serialization import serialize_additional_information
from vllm_omni.engine.stage_pool import StagePool
from vllm_omni.metrics.prometheus import OmniRequestCounter
@@ -221,6 +222,7 @@ class Orchestrator:
running_counter: OmniRequestCounter | None = None,
transfer_emitter: Any = None,
log_stats: bool = False,
enable_orch_monitor: bool = False,
) -> None:
self.request_async_queue = request_async_queue
self.output_async_queue = output_async_queue
@@ -229,6 +231,13 @@ class Orchestrator:
self.async_chunk = bool(async_chunk)
self.num_stages = len(stage_pools)
self.stage_pools: list[StagePool] = stage_pools
self._orch_monitor = create_orch_monitor(
enabled=enable_orch_monitor,
replica_sampler=self._sample_replica_metrics,
)
for stage_id, pool in enumerate(self.stage_pools):
for replica_id in pool.live_replica_ids():
self._orch_monitor.register_replica(stage_id, replica_id)
# PD disaggregation state
self._pd_pair: tuple[int, int] | None = None
@@ -372,6 +381,7 @@ class Orchestrator:
await self._membership.drain_tasks(timeout=10.0)
self._membership.shutdown()
self._orch_monitor.flush()
self._shutdown_stages()
loop = asyncio.get_running_loop()
@@ -402,6 +412,7 @@ class Orchestrator:
elif isinstance(msg, RegisterRemoteReplicaMessage):
if self._membership is not None:
await self._membership.handle_register(msg.stage_id, msg.replica_id)
self._orch_monitor.register_replica(msg.stage_id, msg.replica_id)
elif isinstance(msg, UnregisterRemoteReplicaMessage):
if self._membership is not None:
await self._membership.handle_unregister(msg.stage_id, msg.input_addr)
@@ -629,6 +640,14 @@ class Orchestrator:
# ---- Orchestration loop ----
def _sample_replica_metrics(self) -> dict[str, tuple[int, int]]:
samples: dict[str, tuple[int, int]] = {}
for stage_id, pool in enumerate(self.stage_pools):
for replica_id in pool.live_replica_ids():
key = replica_key(stage_id, replica_id)
samples[key] = pool.replica_monitor_sample(replica_id)
return samples
async def _orchestration_output_handler(self) -> None:
"""Poll all stages, handle transfers, send final outputs to main."""
try:
@@ -737,6 +756,7 @@ class Orchestrator:
await self._handle_processed_outputs(stage_id, replica_id, raw_output)
idle = False
self._orch_monitor.note_loop(idle=idle)
if idle:
await asyncio.sleep(0.001)
else: