From 86e20769fd7016c4d61fa85d93b4a3cd0d91c185 Mon Sep 17 00:00:00 2001 From: tzhouam Date: Thu, 12 Feb 2026 08:52:27 +0000 Subject: [PATCH] Add SSL context support in benchmark function for improved connection handling Signed-off-by: tzhouam --- vllm_omni/benchmarks/patch/patch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/vllm_omni/benchmarks/patch/patch.py b/vllm_omni/benchmarks/patch/patch.py index 775568a72..6066be44a 100644 --- a/vllm_omni/benchmarks/patch/patch.py +++ b/vllm_omni/benchmarks/patch/patch.py @@ -5,6 +5,7 @@ import io import json import os import random +import ssl import sys import time import traceback @@ -238,6 +239,7 @@ async def benchmark( ramp_up_start_rps: int | None = None, ramp_up_end_rps: int | None = None, ready_check_timeout_sec: int = 600, + ssl_context: ssl.SSLContext | bool | None = None, ): try: request_func = ASYNC_REQUEST_FUNCS[endpoint_type] @@ -245,6 +247,7 @@ async def benchmark( raise ValueError(f"Unknown backend: {endpoint_type}") from None # Reuses connections across requests to reduce TLS handshake overhead. + ssl_setting = ssl_context if ssl_context is not None else ("https://" in api_url) connector = aiohttp.TCPConnector( limit=max_concurrency or 0, limit_per_host=max_concurrency or 0, @@ -253,7 +256,7 @@ async def benchmark( keepalive_timeout=60, enable_cleanup_closed=True, force_close=False, - ssl=("https://" in api_url), + ssl=ssl_setting, ) session = aiohttp.ClientSession(