Skip to content

Add Caching for RepositoryData in BlobStoreRepository (#52341)#52566

Merged
original-brownbear merged 2 commits intoelastic:7.xfrom
original-brownbear:52341-7.x
Feb 21, 2020
Merged

Add Caching for RepositoryData in BlobStoreRepository (#52341)#52566
original-brownbear merged 2 commits intoelastic:7.xfrom
original-brownbear:52341-7.x

Conversation

@original-brownbear
Copy link
Copy Markdown
Contributor

Cache latest RepositoryData on heap when it's absolutely safe to do so (i.e. when the repository is in strictly consistent mode).

RepositoryData can safely be assumed to not grow to a size that would cause trouble because we often have at least two copies of it loaded at the same time when doing repository operations. Also, concurrent snapshot API status requests currently load it independently of each other and so on, making it safe to cache on heap and assume as "small" IMO.

The benefits of this move are:

  • Much faster repository status API calls
    • listing all snapshot names becomes instant
    • Other operations are sped up massively too because they mostly operate in two steps: load repository data then load multiple other blobs to get the additional data
  • Additional cloud cost savings
  • Better resiliency, saving another spot where an IO issue could break the snapshot
  • We can simplify a number of spots in the current code that currently pass around the repository data in tricky ways to avoid loading it multiple times in follow ups.

backport of #52341

Cache latest `RepositoryData` on heap when it's absolutely safe to do so (i.e. when the repository is in strictly consistent mode).

`RepositoryData` can safely be assumed to not grow to a size that would cause trouble because we often have at least two copies of it loaded at the same time when doing repository operations. Also, concurrent snapshot API status requests currently load it independently of each other and so on, making it safe to cache on heap and assume as "small" IMO.

The benefits of this move are:
* Much faster repository status API calls
   * listing all snapshot names becomes instant
   * Other operations are sped up massively too because they mostly operate in two steps: load repository data then load multiple other blobs to get the additional data
* Additional cloud cost savings
* Better resiliency, saving another spot where an IO issue could break the snapshot
* We can simplify a number of spots in the current code that currently pass around the repository data in tricky ways to avoid loading it multiple times in follow ups.
@original-brownbear original-brownbear added :Distributed/Snapshot/Restore Anything directly related to the `_snapshot/*` APIs backport labels Feb 20, 2020
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-distributed (:Distributed/Snapshot/Restore)

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants