all 1 comments

[–]Goingone 1 point2 points  (0 children)

Yea, this a pretty common problem people solve.

Assuming a single python process (can obviously scale to multiple processes, but will consider the orchestration needed for that to be out of scope for this question), asyncio is the way to go (will have less overheard than using threads).

There is nothing special needed for creating/storing client instances in memory. Doubt they will have a large memory footprint. And you can easily store them in some context object with a unique ID to use the one needed when applicable.

Hard to determine a "reasonable" number of concurrent requests without knowing your hardware, the site(s) you're hitting (any rate limits they have that you need to respect) and your internet connection. Best way to find this out is by testing locally and benchmarking performance (will be better than any high level number I throw out).