Multi-threaded snapshot download #3522
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes
snapshot_downloaddownload files in parallel all the time. Previously we were not doing it ifHF_XET_HIGH_PERFORMANCE=1was set as environment variable. Goal was to avoid bloating the CPU if Xet starts N threads for each of the X files being downloaded in parallel. We had a similar logic forhf_transfer. However after some discussions on slack (private) and following this gist, it turns out thathf_xetis doing things much more carefully thanhf_transferby reusing the same pool of connections no matter the number of parallel calls. This means that even ifsnapshot_downloadstarts N threads, they will all share the same Xet resources without freezing the user's machine.Hence this PR.
Quick benchmark (not a scientific one^^):
On
main: 7'20On this PR: 3'50