[Frontend][V1] Online serving performance improvements (#12287)

This commit is contained in:
Nick Hill
2025-01-22 14:22:12 -08:00
committed by GitHub
parent 7206ce4ce1
commit aea94362c9
7 changed files with 100 additions and 44 deletions

View File

@@ -1,5 +1,6 @@
import asyncio
import atexit
import gc
import importlib
import inspect
import multiprocessing
@@ -104,6 +105,11 @@ async def lifespan(app: FastAPI):
task.add_done_callback(_running_tasks.remove)
else:
task = None
# Mark the startup heap as static so that it's ignored by GC.
# Reduces pause times of oldest generation collections.
gc.collect()
gc.freeze()
try:
yield
finally: