From 32ccfc9a19c63041c3e0f3166f9e14ba16b113e6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 12 Nov 2024 10:34:30 -0600 Subject: [PATCH] Adjust client payload benchmarks to better represent real world cases (#9835) --- tests/test_benchmarks_client.py | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/tests/test_benchmarks_client.py b/tests/test_benchmarks_client.py index 7daddcf3db2..7292e4d647f 100644 --- a/tests/test_benchmarks_client.py +++ b/tests/test_benchmarks_client.py @@ -33,14 +33,14 @@ def _run() -> None: loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_2048_chunked_payload( +def test_one_hundred_get_requests_with_1024_chunked_payload( loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a small payload of 2048 bytes.""" + """Benchmark 100 GET requests with a small payload of 1024 bytes.""" message_count = 100 - payload = b"a" * 2048 + payload = b"a" * 1024 async def handler(request: web.Request) -> web.Response: resp = web.Response(body=payload) @@ -62,14 +62,14 @@ def _run() -> None: loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_32768_chunked_payload( +def test_one_hundred_get_requests_with_30000_chunked_payload( loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 32768 bytes.""" + """Benchmark 100 GET requests with a payload of 30000 bytes.""" message_count = 100 - payload = b"a" * 32768 + payload = b"a" * 30000 async def handler(request: web.Request) -> web.Response: resp = web.Response(body=payload) @@ -91,14 +91,14 @@ def _run() -> None: loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_1mib_chunked_payload( +def test_one_hundred_get_requests_with_512kib_chunked_payload( loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 1MiB bytes.""" + """Benchmark 100 GET requests with a payload of 512KiB.""" message_count = 100 - payload = b"a" * 1024**2 + payload = b"a" * (2**19) async def handler(request: web.Request) -> web.Response: resp = web.Response(body=payload) @@ -120,14 +120,14 @@ def _run() -> None: loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_2048_content_length_payload( +def test_one_hundred_get_requests_with_1024_content_length_payload( loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a small payload of 2048 bytes.""" + """Benchmark 100 GET requests with a small payload of 1024 bytes.""" message_count = 100 - payload = b"a" * 2048 + payload = b"a" * 1024 headers = {hdrs.CONTENT_LENGTH: str(len(payload))} async def handler(request: web.Request) -> web.Response: @@ -148,14 +148,14 @@ def _run() -> None: loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_32768_content_length_payload( +def test_one_hundred_get_requests_with_30000_content_length_payload( loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 32768 bytes.""" + """Benchmark 100 GET requests with a payload of 30000 bytes.""" message_count = 100 - payload = b"a" * 32768 + payload = b"a" * 30000 headers = {hdrs.CONTENT_LENGTH: str(len(payload))} async def handler(request: web.Request) -> web.Response: @@ -176,14 +176,14 @@ def _run() -> None: loop.run_until_complete(run_client_benchmark()) -def test_one_hundred_get_requests_with_1mib_content_length_payload( +def test_one_hundred_get_requests_with_512kib_content_length_payload( loop: asyncio.AbstractEventLoop, aiohttp_client: AiohttpClient, benchmark: BenchmarkFixture, ) -> None: - """Benchmark 100 GET requests with a payload of 1MiB bytes.""" + """Benchmark 100 GET requests with a payload of 512KiB.""" message_count = 100 - payload = b"a" * 1024**2 + payload = b"a" * (2**19) headers = {hdrs.CONTENT_LENGTH: str(len(payload))} async def handler(request: web.Request) -> web.Response: