Skip to content

Commit fc67cfd

Browse files
Increase some size in client benchmark tests (aio-libs#12330)
1 parent 47558a3 commit fc67cfd

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

tests/test_benchmarks_client.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -177,14 +177,14 @@ def _run() -> None:
177177
loop.run_until_complete(run_client_benchmark())
178178

179179

180-
def test_one_hundred_get_requests_with_512kib_chunked_payload(
180+
def test_one_hundred_get_requests_with_10mb_chunked_payload(
181181
loop: asyncio.AbstractEventLoop,
182182
aiohttp_client: AiohttpClient,
183183
benchmark: BenchmarkFixture,
184184
) -> None:
185-
"""Benchmark 100 GET requests with a payload of 512KiB using read."""
185+
"""Benchmark 100 GET requests with a payload of 10 MiB using read."""
186186
message_count = 100
187-
payload = b"a" * (2**19)
187+
payload = b"a" * (10 * 2**20)
188188

189189
async def handler(request: web.Request) -> web.Response:
190190
resp = web.Response(body=payload)
@@ -206,14 +206,14 @@ def _run() -> None:
206206
loop.run_until_complete(run_client_benchmark())
207207

208208

209-
def test_one_hundred_get_requests_iter_chunks_on_512kib_chunked_payload(
209+
def test_one_hundred_get_requests_iter_chunks_on_10mb_chunked_payload(
210210
loop: asyncio.AbstractEventLoop,
211211
aiohttp_client: AiohttpClient,
212212
benchmark: BenchmarkFixture,
213213
) -> None:
214-
"""Benchmark 100 GET requests with a payload of 512KiB using iter_chunks."""
214+
"""Benchmark 100 GET requests with a payload of 10 MiB using iter_chunks."""
215215
message_count = 100
216-
payload = b"a" * (2**19)
216+
payload = b"a" * (10 * 2**20)
217217

218218
async def handler(request: web.Request) -> web.Response:
219219
resp = web.Response(body=payload)
@@ -327,14 +327,14 @@ def _run() -> None:
327327
loop.run_until_complete(run_client_benchmark())
328328

329329

330-
def test_one_hundred_get_requests_with_512kib_content_length_payload(
330+
def test_one_hundred_get_requests_with_10mb_content_length_payload(
331331
loop: asyncio.AbstractEventLoop,
332332
aiohttp_client: AiohttpClient,
333333
benchmark: BenchmarkFixture,
334334
) -> None:
335-
"""Benchmark 100 GET requests with a payload of 512KiB."""
335+
"""Benchmark 100 GET requests with a payload of 10 MiB."""
336336
message_count = 100
337-
payload = b"a" * (2**19)
337+
payload = b"a" * (10 * 2**20)
338338
headers = {hdrs.CONTENT_LENGTH: str(len(payload))}
339339

340340
async def handler(request: web.Request) -> web.Response:
@@ -471,14 +471,15 @@ def _run() -> None:
471471
loop.run_until_complete(run_client_benchmark())
472472

473473

474-
def test_ten_streamed_responses_iter_chunked_65536(
474+
def test_ten_streamed_responses_iter_chunked_1mb(
475475
loop: asyncio.AbstractEventLoop,
476476
aiohttp_client: AiohttpClient,
477477
benchmark: BenchmarkFixture,
478478
) -> None:
479-
"""Benchmark 10 streamed responses using iter_chunked 65536."""
479+
"""Benchmark 10 streamed responses using iter_chunked 1 MiB."""
480480
message_count = 10
481-
data = b"x" * 65536 # 64 KiB chunk size, 64 KiB iter_chunked
481+
MB = 2**20
482+
data = b"x" * 10 * MB
482483

483484
async def handler(request: web.Request) -> web.StreamResponse:
484485
resp = web.StreamResponse()
@@ -494,7 +495,7 @@ async def run_client_benchmark() -> None:
494495
client = await aiohttp_client(app)
495496
for _ in range(message_count):
496497
resp = await client.get("/")
497-
async for _ in resp.content.iter_chunked(65536):
498+
async for _ in resp.content.iter_chunked(MB):
498499
pass
499500
await client.close()
500501

@@ -510,7 +511,7 @@ def test_ten_streamed_responses_iter_chunks(
510511
) -> None:
511512
"""Benchmark 10 streamed responses using iter_chunks."""
512513
message_count = 10
513-
data = b"x" * 65536 # 64 KiB chunk size
514+
data = b"x" * 2**20
514515

515516
async def handler(request: web.Request) -> web.StreamResponse:
516517
resp = web.StreamResponse()

0 commit comments

Comments
 (0)