Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions CHANGES/12569.misc.rst
Original file line number Diff line number Diff line change
@@ -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`.
20 changes: 10 additions & 10 deletions tests/test_benchmarks_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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()
Expand Down
6 changes: 3 additions & 3 deletions tests/test_benchmarks_web_urldispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading