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

Download Rate Limiting & Concurrent Downloads #89

Open
romen-h opened this issue Sep 25, 2023 · 4 comments
Open

Download Rate Limiting & Concurrent Downloads #89

romen-h opened this issue Sep 25, 2023 · 4 comments

Comments

@romen-h
Copy link

romen-h commented Sep 25, 2023

I was wondering if it would be possible to add arguments to control the following behaviour:

  • Download rate limit
    Something like -ratelimit x which would ensure the download rate of any individual worker does not exceed x MB/s.

  • Concurrent downloads (workers)
    Something like -workers x which would ensure x workers are spawned to do the downloads in parallel.

These two arguments would allow me to use this script like a scheduled task or service that does not consume all of my bandwidth in the background. Downloading one file at a time also helps with resuming if the script is terminated since there will be only one partial file that needs to be re-downloaded instead of 4 partial files from cancelling.

@Kalanyr
Copy link
Owner

Kalanyr commented Sep 25, 2023 via email

@romen-h
Copy link
Author

romen-h commented Sep 28, 2023

Thanks for responding.

I will try to find some external way to rate limit just this script, maybe with domain based QoS or something.

I'm still interested in the argument to set the number of workers, but even that might not be necessary if download resuming works. Downloading one file at a time would mean only one part has to be restarted and more parts may have downloaded successfully before an interruption.

@romen-h
Copy link
Author

romen-h commented Sep 28, 2023

Also if you point me to the lines where the HTTP requests for the "chunks" are happening then I might be able to implement this and PR it if it works.

Apparently it's easy to implement rate limiting with the python requests module; You just put a sleep between GET requests for chunks so that your overall rate will not exceed chunk_size / sleep_time.

@Kalanyr
Copy link
Owner

Kalanyr commented Sep 28, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants