Skip to content

More Efficient Ordering of Shard Upload Execution (#42791) #46588

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

Merged
merged 2 commits into from
Sep 11, 2019

Conversation

original-brownbear
Copy link
Member

Inspired by #39657 and resolving the issue raised in that PR:

The problem currently is that we are uploading all segments in a shard sequentially per shard and only parallelize snapshotting across shards but not within shards.
This PR adjusts the logic towards parallel segment uploads:

  • Instead of starting all shard uploads in parallel and without any order, run segment uploads shard by shard.
  • Only acquire index commit when it's actually required (after determining the current state of a shard in the repository, not before that).
    • @DaveCTurner pointed out that going sequentially in determining the segments to upload shard by shard increases the timespan between index commits. This is true for the case pf having more snapshot threads than shards to be snapshotted. On the other hand if there's more shards to be snapshotted on a node than snapshot threads it's the other way around. Currently, in this situation once the snapshot thread pool is fully occupied a shard will have to wait for another shard to completely finish its snapshot before taking the index commit (which could be many minutes!) while now the time span between the index commits is likely never more than a few seconds apart (biggest difference between two index commit times is basically equal to the time it takes all the shard folder listing operations to finish)
  • Release index commit asap (with this change we generally way reduce the amount of time we hold on to an index commit in cases of uploading multiple shards with multiple segments)

Backport of #42791 and #46208

* Change the upload order of of snapshots to work file by file in parallel on the snapshot pool instead of merely shard-by-shard
* Inspired by elastic#39657
Aborts and failures were handled in a somewhat unfortunate way in elastic#42791:
Since the tasks for all files are generated before uploading they are all executed when a snapshot is aborted and lead to a massive number of failures added to the original aborted exception.
In the case of failures the situation was not very reasonable as well. If one blob fails uploading the snapshot logic would upload all the remaining files as well and then fail (when previously it would just fail all following files).
I fixed both of the above issues, by just short-circuiting all remaining tasks for a shard in case of an exception in any one upload.
@original-brownbear original-brownbear added :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs backport labels Sep 11, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-distributed

@original-brownbear original-brownbear changed the title 42791 7.x More Efficient Ordering of Shard Upload Execution (#42791) Sep 11, 2019
@original-brownbear original-brownbear merged commit 41633cb into elastic:7.x Sep 11, 2019
@original-brownbear original-brownbear deleted the 42791-7.x branch September 11, 2019 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport :Distributed Coordination/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants