Support GC Freezing to improve latency & throughput (#9241)

Co-authored-by: Chanh Nguyen <cnguyen@linkedin.com>
Co-authored-by: Liangsheng Yin <hnyls2002@gmail.com>
This commit is contained in:
Chanh Nguyen
2025-08-23 13:43:09 +08:00
committed by GitHub
co-authored by Chanh Nguyen Liangsheng Yin
parent 7e880286b5
commit 127d4b0d5e
8 changed files with 119 additions and 1 deletions
@@ -511,6 +511,18 @@ async def stop_profile_async():
)
@app.api_route("/freeze_gc", methods=["GET", "POST"])
async def freeze_gc_async():
"""
See engine.freeze_gc for more details.
"""
await _global_state.tokenizer_manager.freeze_gc()
return Response(
content="Garbage collection frozen.\n",
status_code=200,
)
@app.api_route("/start_expert_distribution_record", methods=["GET", "POST"])
async def start_expert_distribution_record_async():
"""Start recording the expert distribution. Clear the previous record if any."""