diff --git a/CHANGES/12569.misc.rst b/CHANGES/12569.misc.rst new file mode 100644 index 00000000000..32af3f259b4 --- /dev/null +++ b/CHANGES/12569.misc.rst @@ -0,0 +1,3 @@ +Reduced payload sizes and request counts in the slowest client and URL +dispatcher benchmarks so they no longer dominate CI runtime +-- by :user:`bdraco`. diff --git a/tests/test_benchmarks_client.py b/tests/test_benchmarks_client.py index abcc127af0a..022de894b91 100644 --- a/tests/test_benchmarks_client.py +++ b/tests/test_benchmarks_client.py @@ -205,14 +205,14 @@ def _run() -> None: event_loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_10mb_chunked_payload( +def test_one_hundred_get_requests_with_1mb_chunked_payload( event_loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 10 MiB using read.""" + """Benchmark 100 GET requests with a 1 MiB chunked payload using read.""" message_count = 100 - payload = b"a" * (10 * 2**20) + payload = b"a" * 2**20 async def handler(request: web.Request) -> web.Response: resp = web.Response(body=payload) @@ -234,14 +234,14 @@ def _run() -> None: event_loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_iter_chunks_on_10mb_chunked_payload( +def test_one_hundred_get_requests_iter_chunks_on_1mb_chunked_payload( event_loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 10 MiB using iter_chunks.""" + """Benchmark 100 GET requests with a 1 MiB chunked payload using iter_chunks.""" message_count = 100 - payload = b"a" * (10 * 2**20) + payload = b"a" * 2**20 async def handler(request: web.Request) -> web.Response: resp = web.Response(body=payload) @@ -355,14 +355,14 @@ def _run() -> None: event_loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_10mb_content_length_payload( +def test_one_hundred_get_requests_with_1mb_content_length_payload( event_loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 10 MiB.""" + """Benchmark 100 GET requests with a content-length payload of 1 MiB.""" message_count = 100 - payload = b"a" * (10 * 2**20) + payload = b"a" * 2**20 headers = {hdrs.CONTENT_LENGTH: str(len(payload))} async def handler(request: web.Request) -> web.Response: @@ -507,7 +507,7 @@ def test_ten_streamed_responses_iter_chunked_1mb( """Benchmark 10 streamed responses using iter_chunked 1 MiB.""" message_count = 10 MB = 2**20 - data = b"x" * 10 * MB + data = b"x" * 6 * MB async def handler(request: web.Request) -> web.StreamResponse: resp = web.StreamResponse() diff --git a/tests/test_benchmarks_web_urldispatcher.py b/tests/test_benchmarks_web_urldispatcher.py index 4fe8bcae929..0304db3b8b6 100644 --- a/tests/test_benchmarks_web_urldispatcher.py +++ b/tests/test_benchmarks_web_urldispatcher.py @@ -360,7 +360,7 @@ async def handler(request: web.Request) -> NoReturn: requests = [ _mock_request(method="GET", path=f"/api/{customer}/update") - for customer in range(250) + for customer in range(150) ] async def run_url_dispatcher_benchmark() -> web.UrlMappingMatchInfo | None: @@ -402,7 +402,7 @@ async def handler(request: web.Request) -> NoReturn: alnums = string.ascii_letters + string.digits requests = [] - for i in range(250): + for i in range(150): owner = "".join(random.sample(alnums, 10)) repo = "".join(random.sample(alnums, 10)) pull_number = random.randint(0, 250) @@ -473,7 +473,7 @@ async def handler(request: web.Request) -> NoReturn: alnums = string.ascii_letters + string.digits requests = [] - for i in range(250): + for i in range(150): owner = "".join(random.sample(alnums, 10)) repo = "".join(random.sample(alnums, 10)) pull_number = random.randint(0, 250)