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

perf(blockstore)!: Cache more in blockstore, which speedsup the gossip routines #3342 #116

Merged
merged 7 commits into from
Jun 26, 2024

Conversation

ValarDragon
Copy link
Member

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 cometbft#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.

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 ValarDragon merged commit 6883141 into osmo-v25/v0.37.4 Jun 26, 2024
15 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant