[Perf] Freeze core engine proc heap after init (#24008)

Signed-off-by: Nick Hill <nhill@redhat.com>
This commit is contained in:
Nick Hill 2025-09-04 07:55:23 -07:00 committed by GitHub
parent 37241077d5
commit e41a0fa377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
import gc
import os
import queue
import signal
@ -536,6 +537,11 @@ class EngineCoreProc(EngineCore):
self.step_fn = (self.step if self.batch_queue is None else
self.step_with_batch_queue)
# Mark the startup heap as static so that it's ignored by GC.
# Reduces pause times of oldest generation collections.
gc.collect()
gc.freeze()
@contextmanager
def _perform_handshakes(
self,