-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Is your feature request related to a problem? Please describe.
When calling download_fileobj, the transfer_future.meta.size is unsurprisingly None, causing a head_object to take place. Only to fetch the size of the object. You can see this here: https://github.com/boto/s3transfer/blob/ccb71ddd89149a4bc5a45a2fcd5e42aafba3f0ea/s3transfer/download.py#L339-L348
In cases where you're calling download_fileobj on many files following a list-operation -- which already provides object sizes in its response! -- this seems rather wasteful, and causes overall latency to hurt measurably. This is especially visible when dealing with many small objects.
I only looked into download_fileobj, but I can imagine the same applies to download_file, and possibly other scenarios. I understand that me using unmanaged downloads would avoid this problem altogether, but I'm not really asking for workarounds.
Describe the solution you'd like
If download_fileobj, either via TransferConfig, or perhaps better, via ExtraArgs would accept a "size hint" that we could provide following a list-operation, that head-request could be avoided, latency would drop and cost (Lambda execution time and S3 requests) would decrease.