3
Question
Why is asyncio.gather slower than sequential requests in this script?
I expected these requests to run concurrently, but the async version is slightly slower.
async def load(url):
async with aiohttp.ClientSession() as session:
async with session.get(url) as response:
return await response.json()
results = await asyncio.gather(*(load(url) for url in urls))
There are about 80 URLs from the same API.