Skip to content

Sending operations concurrently in peer recovery#58018

Merged
dnhatn merged 14 commits intoelastic:masterfrom
dnhatn:send-ops-concurrently
Jul 7, 2020
Merged

Sending operations concurrently in peer recovery#58018
dnhatn merged 14 commits intoelastic:masterfrom
dnhatn:send-ops-concurrently

Conversation

@dnhatn
Copy link
Copy Markdown
Member

@dnhatn dnhatn commented Jun 12, 2020

Today, we send operations in phase2 of peer recoveries batch by batch sequentially. Normally that's okay as we should have a fairly small of operations in phase 2 due to the file-based threshold. However, if phase1 takes a lot of time and we are actively indexing, then phase2 can have a lot of operations to replay.

With this change, we will send multiple batches concurrently (defaults to 1) to reduce the recovery time.

Relates #58011

@dnhatn dnhatn added >enhancement :Distributed/Recovery Anything around constructing a new shard, either from a local or a remote source. v8.0.0 v7.9.0 labels Jun 12, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (:Distributed/Recovery)

@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team. label Jun 12, 2020
Copy link
Copy Markdown
Member

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a little risky; I've seen cases where it appeared that the load from recovery phase 2 already has a performance impact on indexing into other active shards on the target node. It's certainly nice to have the option of more concurrency in phase 2 but I think we should be cautious about doing so by default.

I'll link such a case to this PR.

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question on the mechanics of this, maybe I'm missing something here.

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me technically :)

I share Davids concern though. Even more so if we start moving the handler for this to WRITE which under load could cause additional trouble from more rejections in a case like the one David linked. Maybe we should just default to the current behavior for now and make this optional?

@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Jul 6, 2020

@DaveCTurner @original-brownbear Thanks for reviewing. I've added a new recovery setting that controls the number of operation chunks sent in parallel. Could you please take another look?

@original-brownbear
Copy link
Copy Markdown
Contributor

@dnhatn will take a look soon, but FYI there's some random CS failure here in :test:framework:checkstyleMain :)

Copy link
Copy Markdown
Contributor

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@dnhatn dnhatn requested a review from DaveCTurner July 7, 2020 14:47
Copy link
Copy Markdown
Member

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Docs & naming LGTM; I haven't reviewed the code change in detail but I think Armin did.

@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Jul 7, 2020

run elasticsearch-ci/2

@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Jul 7, 2020

@elasticmachine update branch

@dnhatn
Copy link
Copy Markdown
Member Author

dnhatn commented Jul 7, 2020

@original-brownbear @DaveCTurner Thanks for reviewing.

@dnhatn dnhatn merged commit 961db31 into elastic:master Jul 7, 2020
@dnhatn dnhatn deleted the send-ops-concurrently branch July 7, 2020 22:00
dnhatn added a commit that referenced this pull request Jul 8, 2020
Today, we send operations in phase2 of peer recoveries batch by batch
sequentially. Normally that's okay as we should have a fairly small of
operations in phase 2 due to the file-based threshold. However, if
phase1 takes a lot of time and we are actively indexing, then phase2 can
have a lot of operations to replay.

With this change, we will send multiple batches concurrently (defaults
to 1) to reduce the recovery time.

Backport of #58018
dnhatn added a commit that referenced this pull request Jul 8, 2020
We need to use a concurrent collection to keep track of the shipped operations
as they can arrive concurrently since #58018.

Relates #58018
dnhatn added a commit that referenced this pull request Jul 8, 2020
We need to use a concurrent collection to keep track of the shipped operations
as they can arrive concurrently since #58018.

Relates #58018
dnhatn added a commit that referenced this pull request Jul 8, 2020
The recovery chunk size setting was injected in #58018, but too
aggressively and broke several tests. This change removes that
random injection.

Relates #58018
dnhatn added a commit that referenced this pull request Jul 8, 2020
The recovery chunk size setting was injected in #58018, but too
aggressively and broke several tests. This change removes that
random injection.

Relates #58018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Distributed/Recovery Anything around constructing a new shard, either from a local or a remote source. >enhancement Team:Distributed Meta label for distributed team. v7.9.0 v8.0.0-alpha1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants