[PD] Add control to slow down a server (#5572)

This commit is contained in:
fzyzcjy
2025-05-08 01:03:08 -07:00
committed by GitHub
parent 6450c1228c
commit cef91b1ed7
4 changed files with 57 additions and 0 deletions
@@ -62,6 +62,7 @@ from sglang.srt.managers.io_struct import (
ResumeMemoryOccupationReqInput,
SeparateReasoningReqInput,
SetInternalStateReq,
SlowDownReqInput,
UpdateWeightFromDiskReqInput,
UpdateWeightsFromDistributedReqInput,
UpdateWeightsFromTensorReqInput,
@@ -494,6 +495,19 @@ async def resume_memory_occupation(
return _create_error_response(e)
@app.api_route("/slow_down", methods=["GET", "POST"])
async def slow_down(obj: SlowDownReqInput, request: Request):
"""Slow down the system deliberately. Only for testing. Example scenario:
when we want to test performance of D in large-scale PD disaggregation and have no enough nodes for P,
we can use this to slow down D to let it have enough running sequences, and then disable slowdown
to let it run in full batch size.
"""
try:
await _global_state.tokenizer_manager.slow_down(obj, request)
except Exception as e:
return _create_error_response(e)
@app.api_route("/open_session", methods=["GET", "POST"])
async def open_session(obj: OpenSessionReqInput, request: Request):
"""Open a session, and return its unique session id."""