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

Use threads for glacier restore for 100x speedup. #749

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabend
Copy link

@gabend gabend commented Jun 6, 2016

Each call to the restore API has significant latency, but very little
data. For restoring large sets of files, the serialized request loop is
very, very slow. Parallel requests make a significant speedup for large
sets of files.

When hammering S3 with a large set of requests, some of them will
timeout (even if run serially). Adding retry logic alleviates the need
to re-run the command from scratch.

Each call to the restore API has significant latency, but very little
data.  For restoring large sets of files, the serialized request loop is
very, very slow.  Parallel requests make a significant speedup for large
sets of files.

When hammering S3 with a large set of requests, some of them will
timeout (even if run serially).  Adding retry logic alleviates the need
to re-run the command from scratch.
@gabend
Copy link
Author

gabend commented Jun 6, 2016

I tried using s3cmd restore on a directory tree with tens of thousands of files. From the command output, it looked like s3cmd was issueing 3-4 requests per second, and the operation would have taken hours to complete. It would have, because after about 20 minutes, it failed because one request fimed out and the operation failed. Running the command again got me a bit further, but it eventually failed a 2nd time. I think I would have needed to run in a shell loop for many tries to eventually get through all my files.

Adding retries and using a thread pool got me to the point where I could successfully restore the whole directory tree in about 10 minutes, running the command once.

@fviard
Copy link
Contributor

fviard commented Jun 27, 2016

Thank you for your contribution and sorry for the delay in reviewing.
The idea is pretty good.
I don't think that we will merge it for the moment, because I think that your PR scratch the surface of something more global that has to be done for s3cmd. A long requested feature is to have more operations done in parallel. So, that means not only for restore, but also for upload, download, etc... and that being user configurable.
So, if that work is done, probably you work would be merged as part of it.

The issue is a little more complex than what it looks because the point is that we can see 2 different kind of parallelism: same task spited (like for the restore here), and different tasks in parallel (like having the local list and remote list built in the same time.

@obazoud
Copy link

obazoud commented Jan 15, 2018

any news ?

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

Successfully merging this pull request may close these issues.

3 participants