From 70c904c188a3e24779d6b84495e5d377a3efd70f Mon Sep 17 00:00:00 2001 From: "xinjun.jiang" Date: Fri, 12 Sep 2025 15:53:49 +0800 Subject: [PATCH] fix(backend): Prevent redundant backend validation in worker processes When running a concurrent benchmark, each worker process currently re-validates the backend instance. This leads to multiple, unnecessary "Test connection" requests being sent to the target endpoint, adding startup latency and log verbosity. Signed-off-by: xinjun.jiang --- src/guidellm/backend/backend.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/guidellm/backend/backend.py b/src/guidellm/backend/backend.py index bf2788a7..bcca8483 100644 --- a/src/guidellm/backend/backend.py +++ b/src/guidellm/backend/backend.py @@ -79,6 +79,7 @@ def create(cls, type_: BackendType, **kwargs) -> "Backend": def __init__(self, type_: BackendType): self._type = type_ + self._validated = False @property def type_(self) -> BackendType: @@ -124,6 +125,8 @@ async def validate(self): Handle final setup and validate the backend is ready for use. If not successful, raises the appropriate exception. """ + if self._validated: + return logger.info("{} validating backend {}", self.__class__.__name__, self.type_) await self.check_setup() models = await self.available_models() @@ -146,6 +149,7 @@ async def validate(self): pass await self.reset() + self._validated = True @abstractmethod async def check_setup(self):