Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support max connections per server #39

Open
Cadair opened this issue Mar 7, 2020 · 4 comments
Open

Support max connections per server #39

Cadair opened this issue Mar 7, 2020 · 4 comments
Labels
enhancement A new feature or other enhancement to the library help wanted

Comments

@Cadair
Copy link
Owner

Cadair commented Mar 7, 2020

Given we can now open many connections per server (n files x n splits) it would be useful to be able to specify limits for servers which are not able (or even block) too many connections. This would mean that we could prioritise downloads from other servers to maintain the parallelism while putting less load on servers.

@Cadair Cadair added enhancement A new feature or other enhancement to the library help wanted labels Mar 7, 2020
@Cadair
Copy link
Owner Author

Cadair commented Jun 23, 2022

This appears to be possible to do with aiohttp by customising the connector class used: https://docs.aiohttp.org/en/stable/client_reference.html#baseconnector

We would probably want to be a little smarter than that though so that we don't fill up the download queue with pending downloads from a host where the max number of connections is lower than the number of parallel downloads * number of splits.

@exitflynn
Copy link

exitflynn commented Jan 10, 2023

Hi @Cadair!

We would probably want to be a little smarter than that though so that we don't fill up the download queue with pending downloads from a host where the max number of connections is lower than the number of parallel downloads * number of splits.

I'm a bit confused and having trouble understanding this, implementing a way to set the limit_per_host = (no. of parallel downloads) * (no. of splits) should work right? If a user requests more files than that, then they're bound to go in pending, we can't really do much about it? (assuming we only have a single source to download from)

@exitflynn
Copy link

oooh i think i get it now, if many files are enqueued and a handful of them are from a server which has less max_conn limits, we could end up in a scenario where the queue, which has other files to download from different servers, is now filled up by the pending downloads due to that particular server.

But, shouldn't this not be a problem since we're doing things asynchronously here? A lot of pending downloads due to one server shouldn't cause a hold-up for others, right?

Gah! I think i'm still having trouble understanding the issue here 😅

@Cadair
Copy link
Owner Author

Cadair commented Mar 28, 2023

So this issue is about having a limit on max_splits * max_conn per server. Imagine you have 100 files from 10 servers. Nine servers can handle the default number of connections, but one server can only handle one connection at a time. This issue is about limiting just that server to one connection while all the others can have many.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement A new feature or other enhancement to the library help wanted
Projects
None yet
Development

No branches or pull requests

2 participants