Skip to content

Save Memory on Large Repository Metadata Blob Writes#74693

Merged
original-brownbear merged 2 commits intoelastic:7.xfrom
original-brownbear:74313-7.x
Jun 29, 2021
Merged

Save Memory on Large Repository Metadata Blob Writes#74693
original-brownbear merged 2 commits intoelastic:7.xfrom
original-brownbear:74313-7.x

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

This PR adds a new API for doing streaming serialization writes to a repository to enable repository metadata of arbitrary size and at bounded memory during writing.
The existing write-APIs require knowledge of the eventual blob size beforehand. This forced us to materialize the serialized blob in memory before writing, costing a lot of memory in case of e.g. very large RepositoryData (and limiting us to 2G max blob size).
With this PR the requirement to fully materialize the serialized metadata goes away and the memory overhead becomes completely bounded by the outbound buffer size of the repository implementation.

As we move to larger repositories this makes master node stability a lot more predictable since writing out RepositoryData does not take as much memory any longer (same applies to shard level metadata), enables aggregating multiple metadata blobs into a single larger blobs without massive overhead and removes the 2G size limit on RepositoryData.

backport of #74313 and #74620

Extracted the chunked output stream logic from #74313 and added tests for it to make it easier to review.
This PR adds a new API for doing streaming serialization writes to a repository to enable repository metadata of arbitrary size and at bounded memory during writing.
The existing write-APIs require knowledge of the eventual blob size beforehand. This forced us to materialize the serialized blob in memory before writing, costing a lot of memory in case of e.g. very large `RepositoryData` (and limiting us to `2G` max blob size).
With this PR the requirement to fully materialize the serialized metadata goes away and the memory overhead becomes completely bounded by the outbound buffer size of the repository implementation.

As we move to larger repositories this makes master node stability a lot more predictable since writing out `RepositoryData` does not take as much memory any longer (same applies to shard level metadata), enables aggregating multiple metadata blobs into a single larger blobs without massive overhead and removes the 2G size limit on `RepositoryData`.
@original-brownbear original-brownbear added :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs backport labels Jun 29, 2021
@elasticmachine elasticmachine added the Team:Distributed Meta label for distributed team. label Jun 29, 2021
@elasticmachine
Copy link
Copy Markdown
Collaborator

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

@original-brownbear original-brownbear merged commit ffeafae into elastic:7.x Jun 29, 2021
@original-brownbear original-brownbear deleted the 74313-7.x branch June 29, 2021 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs Team:Distributed Meta label for distributed team. v7.14.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants