awslabs / aws-s3-transfer-manager-rs

Apache License 2.0
5 stars 0 forks source link

Flow-control for download #58

Open graebm opened 6 days ago

graebm commented 6 days ago

We don't want to fill RAM with parts faster than the user can handle them. It's a waste of resources, and can lead to inefficiencies.

For example, when downloading a file to disk, EBS is the bottleneck. If we download as fast as possible we're filling RAM with parts much faster than we can deal with them, which wastes RAM. It also leads to inefficiencies if many files are downloading at once. We can write multiple files faster than writing one. If the first file is hogging all the concurrency, the other files will be starved.

There should be some mechanism for per-object flow-control. Maybe a maximum "window" of uncollected parts per object? Maybe a collect function where the user indicates the maximum number of parts or bytes they're willing to receive? Maybe something like Java's Flow.Subscription.request()?