Repository navigation
Description
Part of #1315.
Summary
S3FileSystem.get_file() reads the object through a file one block at a time, so a download runs at one stream's throughput whatever max_workers is. In the s3fs comparison (#1318, recorded by #1321), s3fs's get_file(), which downloads max_concurrency ranges at a time, was 2.2 to 3.7 times faster with 8 MiB chunks and 5 to 9 times faster with its default 50 MiB chunks for objects of 256 MiB and larger.
AioS3FileSystem._get_file() runs the synchronous method in a thread and has the same limit.
Measurements
One object on one c8gn.2xlarge, MiB/s (median of five trials), PyAthena with 8 MiB blocks and 8 or 40 workers:
| Object | S3FileSystem |
AioS3FileSystem |
s3fs, 8 MiB chunks | s3fs, 50 MiB chunks (default) |
|---|---|---|---|---|
| 64 MiB | 72 to 73 | 68 to 73 | 162 to 181 | 103 to 104 |
| 256 MiB | 54 to 69 | 67 to 70 | 199 to 225 | 349 to 356 |
| 1 GiB | 68 to 70 | 69 to 70 | 221 to 243 | 451 to 632 |
The same objects read with open().read(), which requests the ranges in parallel, ran at 440 to 600 MiB/s for 1 GiB.
Cause
get_file() opens the remote file and copies it with remote.read(remote.blocksize) in a loop. The file's bytes cache requests the next block with the first read and one block at a time afterwards, so the file's executor never runs more than one range request.
Questions
- Whether
get_file()downloads ranges ofblock_sizewith up tomax_workersrequests at a time, asopen().read()does, and writes them to the local file at their offsets or in order. - Memory: how many ranges may be held before they are written; s3fs's download of 1 GiB with
max_concurrency40 peaked at 0.9 to 2.1 GiB, against 0.3 GiB for PyAthena's sequential read. - Consistency of a multi-request download: keep the
IfMatchcondition on the ETag thatopen()sends today, so that an object replaced during a multi-request download fails instead of mixing two versions. - Failure handling: no partial local file after a failed download, and
callbackprogress with out-of-order completion.
Validation
Re-run the filesystem suite's get cases at small, medium, and large and compare them with the s3fs cases of the entry above.
Activity