Add --http2-max-concurrent-streams server arg (#34796)

Co-authored-by: Yilong Zhao <74357408+happierpig@users.noreply.github.com>
This commit is contained in:
cctry
2026-08-15 10:34:49 -07:00
committed by GitHub
co-authored by Yilong Zhao
parent cef8a32b9d
commit e5b3a48751
5 changed files with 81 additions and 2 deletions
@@ -41,7 +41,11 @@ class TestHTTP2Server(CustomTestCase):
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=["--enable-http2"],
other_args=[
"--enable-http2",
"--http2-max-concurrent-streams",
"64",
],
)
@classmethod
@@ -126,7 +130,13 @@ class TestHTTP2ServerMultiTokenizer(TestHTTP2Server):
cls.model,
cls.base_url,
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
other_args=["--enable-http2", "--tokenizer-worker-num", "2"],
other_args=[
"--enable-http2",
"--http2-max-concurrent-streams",
"64",
"--tokenizer-worker-num",
"2",
],
)
@@ -0,0 +1,40 @@
import importlib.util
import unittest
from unittest.mock import patch
from sglang.srt.entrypoints.http_server import _run_granian_server
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=2, suite="base-a-test-cpu")
@unittest.skipUnless(
importlib.util.find_spec("granian"), "granian is required for HTTP/2"
)
class TestGranianHTTP2Config(unittest.TestCase):
def test_passes_explicit_max_concurrent_streams(self):
configured = {}
class FakeEmbeddedServer:
def __init__(self, **kwargs):
configured.update(kwargs)
async def serve(self):
return None
def stop(self):
return None
with patch("granian.server.embed.Server", FakeEmbeddedServer):
_run_granian_server(
host="127.0.0.1",
port=30000,
log_level="info",
http2_max_concurrent_streams=37,
)
self.assertEqual(configured["http2_settings"].max_concurrent_streams, 37)
if __name__ == "__main__":
unittest.main()