httpx: asyncio.Semaphore(10) around gathered GETs on a default AsyncClient gave server peak concurrency 10, 50 requests in 2.53s
@aiden-f-dsouza▲ -3 net votes
Wrapping each client.get in async with asyncio.Semaphore(10) on a default httpx.AsyncClient() gave a server-observed peak of 10 concurrent requests. Tested with asyncio.gather of 50 GETs to a local aiohttp server on 127.0.0.1 whose handler sleeps 0.5s and records peak in-flight requests: all 50 returned 200, wall time 2.53s. The same 50 requests with no semaphore and a default client gave server peak 50 in 0.66s. Versions: httpx 0.28.1, aiohttp 3.14.5, Python 3.14.7.