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

Recovery buffer size 16B smaller #50100

Conversation

henningandersen
Copy link
Contributor

G1GC will use humongous allocations when an allocation exceeds half the
chosen region size, which is minimum 1MB. By reducing the recovery
buffer size by 16 bytes we ensure that the recovery buffer is never
allocated as a humongous allocation.

G1GC will use humongous allocations when an allocation exceeds half the
chosen region size, which is minimum 1MB. By reducing the recovery
buffer size by 16 bytes we ensure that the recovery buffer is never
allocated as a humongous allocation.
@henningandersen henningandersen added >enhancement :Distributed Indexing/Recovery Anything around constructing a new shard, either from a local or a remote source. v8.0.0 v7.6.0 labels Dec 11, 2019
@elasticmachine
Copy link
Collaborator

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

Copy link
Member

@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.

Does this really matter much for recoveries? We only have a very limited number of these arrays in existence at any given time anyway and heavily reuse them don't we? (not that I see any downside to the change otherwise :) just wondering)

@henningandersen
Copy link
Contributor Author

We generate one such byte array per shard recovery on source. Not a lot of activity, but still I felt like the right thing to do here was to make the buffer 16 bytes smaller since it is unlikely to affect recovery speed.

A separate issue is that as far as I can see we allocate new byte arrays currently on the target for every chunk, since RecoveryFileChunkRequest calls in.readBytesReference(), which allocates a new byte array. This sounds like something we should fix separately, but this PR also lowers the impact of that for G1GC in the mean-time. I can double check this part tomorrow.

@Tim-Brooks
Copy link
Contributor

A separate issue is that as far as I can see we allocate new byte arrays currently on the target for every chunk, since RecoveryFileChunkRequest calls in.readBytesReference(), which allocates a new byte array. This sounds like something we should fix separately, but this PR also lowers the impact of that for G1GC in the mean-time. I can double check this part tomorrow.

This is correct. I have been working on a mechanism to prevent these allocations (probably for peer recovery file chunks and index operations). It should be opened pretty soon.

@Tim-Brooks
Copy link
Contributor

Tim-Brooks commented Dec 11, 2019

We generate one such byte array per shard recovery on source.

Also it looks like this is no longer true (I am confident it used to be true). It looks like when we made the recovery process async, we now do an allocate and copy in AsyncRecoveryTarget.

@Tim-Brooks
Copy link
Contributor

Scratch my last comment, it looks like that async thing is only for testing simulation purposes.

Copy link
Member

@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.

I'm not convinced this will have much if any practical impact but I don't see a downside either
=> LGTM :)

@henningandersen henningandersen merged commit 7b863dc into elastic:master Dec 16, 2019
henningandersen added a commit that referenced this pull request Dec 16, 2019
G1GC will use humongous allocations when an allocation exceeds half the
chosen region size, which is minimum 1MB. By reducing the recovery
buffer size by 16 bytes we ensure that the recovery buffer is never
allocated as a humongous allocation.
SivagurunathanV pushed a commit to SivagurunathanV/elasticsearch that referenced this pull request Jan 23, 2020
G1GC will use humongous allocations when an allocation exceeds half the
chosen region size, which is minimum 1MB. By reducing the recovery
buffer size by 16 bytes we ensure that the recovery buffer is never
allocated as a humongous allocation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Recovery Anything around constructing a new shard, either from a local or a remote source. >enhancement v7.6.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants