perf(blockstore)!: Cache more in blockstore, which speedsup the gossip routines#3342
Merged
perf(blockstore)!: Cache more in blockstore, which speedsup the gossip routines#3342
Conversation
This is done by using caches for LoadBlockPart, and making LoadBlockCommit no longer call Clone, as the caller does read-only operations to it. This results in a net performance improvement, based on a 2hr sync on latest osmosis release, of: - 20% less RAM allocated over program lifetime. (76GB no longer allocated, 380 GB alloc total) - 50% speedup to gossipDataRoutine - ~10% speedup to gossipVotesRoutine - 1% less overall system CPU usage. (If GC proportional to bytes allocated, then 5% less)
ValarDragon
added a commit
to osmosis-labs/cometbft
that referenced
this pull request
Jun 26, 2024
…p routines cometbft#3342 (#116) * Speedup / reduce overhead of the gossip routines. This is done by using caches for LoadBlockPart, and making LoadBlockCommit no longer call Clone, as the caller does read-only operations to it. This results in a net performance improvement, based on a 2hr sync on latest osmosis release, of: - 20% less RAM allocated over program lifetime. (76GB no longer allocated, 380 GB alloc total) - 50% speedup to gossipDataRoutine - ~10% speedup to gossipVotesRoutine - 1% less overall system CPU usage. (If GC proportional to bytes allocated, then 5% less) * Add changelog * Make caches respect pruning * Add changelog * Remove concerns * Use my upstream fixes
4 tasks
Collaborator
|
@mergify backport v1.x |
Contributor
✅ Backports have been createdDetails
|
mergify bot
pushed a commit
that referenced
this pull request
Jul 10, 2024
…p routines (#3342) We speedup the gossip routines by using caches for LoadBlockPart, and making LoadBlockCommit no longer call Clone, as the caller does read-only operations to it. This is a followup to #3003 This results in a net performance improvement, based on a 2hr sync on latest osmosis release, of: - 20% less RAM allocated over program lifetime. (76GB no longer allocated, 380 GB alloc total) - 50% speedup to gossipDataRoutine - ~10% speedup to gossipVotesRoutine - 1% less overall system CPU usage. (If GC proportional to bytes allocated, then 5% less) I have checked that every usage of `LoadBlockPart` and `LoadBlockCommit` do not modify the return value, so returning this underlying cache copy is safe for the current codebase I used an `!` in the title, since this is technically API breaking, even though all current usages are safe. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments - [ ] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec (cherry picked from commit 2c88a26)
4 tasks
melekes
pushed a commit
that referenced
this pull request
Jul 10, 2024
…p routines (backport #3342) (#3482) We speedup the gossip routines by using caches for LoadBlockPart, and making LoadBlockCommit no longer call Clone, as the caller does read-only operations to it. This is a followup to #3003 This results in a net performance improvement, based on a 2hr sync on latest osmosis release, of: - 20% less RAM allocated over program lifetime. (76GB no longer allocated, 380 GB alloc total) - 50% speedup to gossipDataRoutine - ~10% speedup to gossipVotesRoutine - 1% less overall system CPU usage. (If GC proportional to bytes allocated, then 5% less) I have checked that every usage of `LoadBlockPart` and `LoadBlockCommit` do not modify the return value, so returning this underlying cache copy is safe for the current codebase I used an `!` in the title, since this is technically API breaking, even though all current usages are safe. --- #### PR checklist - [ ] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments - [ ] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec <hr>This is an automatic backport of pull request #3342 done by [Mergify](https://mergify.com). Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We speedup the gossip routines by using caches for LoadBlockPart, and making LoadBlockCommit no longer call Clone, as the caller does read-only operations to it.
This is a followup to #3003
This results in a net performance improvement, based on a 2hr sync on latest osmosis release, of:
I have checked that every usage of
LoadBlockPartandLoadBlockCommitdo not modify the return value, so returning this underlying cache copy is safe for the current codebaseI used an
!in the title, since this is technically API breaking, even though all current usages are safe.PR checklist
.changelog(we use unclog to manage our changelog)docs/orspec/) and code comments