Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PR #9835/32ccfc9a backport][3.10] Adjust client payload benchmarks to better represent real world cases #9836

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading