Aiomultiprocess is exceptionally good at scaling network requests. However, the abstraction of tasks to queues scheduled amongst pool workers makes it impossible to enable connection pools for each worker in the current state. Using aiohttp's requests method results in a new session being created for every request, which degrades performance.
This PR nests each pool workers target .run() function within an async context manager that creates an aiohttp clientsession and passes the session into the tasks args.
The PR in its current state will need some clean up before it is ready for merge, but I wanted to submit as a WIP to see if a contribution such as this would even be considered.
Description
Aiomultiprocess is exceptionally good at scaling network requests. However, the abstraction of tasks to queues scheduled amongst pool workers makes it impossible to enable connection pools for each worker in the current state. Using aiohttp's requests method results in a new session being created for every request, which degrades performance.
This PR nests each pool workers target
.run()
function within an async context manager that creates an aiohttp clientsession and passes the session into the tasks args.The PR in its current state will need some clean up before it is ready for merge, but I wanted to submit as a WIP to see if a contribution such as this would even be considered.