Skip to content

Commit

Permalink
[PR #9835/32ccfc9a backport][3.10] Adjust client payload benchmarks t…
Browse files Browse the repository at this point in the history
…o better represent real world cases (#9836)

Co-authored-by: J. Nick Koston <nick@koston.org>
  • Loading branch information
patchback[bot] and bdraco authored Nov 12, 2024
1 parent f3dd0f9 commit 4f4b90f
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions tests/test_benchmarks_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down

0 comments on commit 4f4b90f

Please sign in to comment.