Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,14 @@ def setup_server():

def bench_fastapi(loops, url):
async def run_benchmark():
async with httpx.AsyncClient(trust_env=False) as client:
# Passing a Limits object replaces the AsyncClient defaults, so
# max_keepalive_connections must be set explicitly to keep the
# default idle-connection cap of 20 while raising max_connections.
limits = httpx.Limits(
max_connections=CONCURRENCY,
max_keepalive_connections=20,
)
async with httpx.AsyncClient(limits=limits, trust_env=False) as client:
t0 = pyperf.perf_counter()

for i in range(loops):
Expand Down
Loading