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
Cache filtered block tree #4515
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4515 +/- ##
=======================================
Coverage 54.62% 54.62%
=======================================
Files 231 231
Lines 15214 15214
=======================================
Hits 8310 8310
Misses 5674 5674
Partials 1230 1230 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No mutexes?
Didn't think it was needed because we recalculate/update the map as a whole.. but better be safe than sorry. Defensive programming 101, will add a mutex |
filteredBlocks := make(map[[32]byte]*ethpb.BeaconBlock) | ||
var err error | ||
if featureconfig.Get().EnableBlockTreeCache { | ||
s.filteredBlockTreeLock.Lock() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RLock? Seems like you could process many readers in parallel with attestations coming in pubsub quickly
Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com>
…o cache-filtered-tree
…abs/prysm into cache-filtered-tree
* Cache filtered block tree * Merge refs/heads/master into cache-filtered-tree * Merge refs/heads/master into cache-filtered-tree * Add locks * Merge branch 'cache-filtered-tree' of git+ssh://github.com/prysmaticlabs/prysm into cache-filtered-tree * Confligt * Merge refs/heads/master into cache-filtered-tree * Merge refs/heads/master into cache-filtered-tree * Update shared/featureconfig/flags.go Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com> * Rlock * Merge branch 'master' of git+ssh://github.com/prysmaticlabs/prysm into cache-filtered-tree * Merge branch 'cache-filtered-tree' of git+ssh://github.com/prysmaticlabs/prysm into cache-filtered-tree
* Cache filtered block tree * Merge refs/heads/master into cache-filtered-tree * Merge refs/heads/master into cache-filtered-tree * Add locks * Merge branch 'cache-filtered-tree' of git+ssh://github.com/prysmaticlabs/prysm into cache-filtered-tree * Confligt * Merge refs/heads/master into cache-filtered-tree * Merge refs/heads/master into cache-filtered-tree * Update shared/featureconfig/flags.go Co-Authored-By: Preston Van Loon <preston@prysmaticlabs.com> * Rlock * Merge branch 'master' of git+ssh://github.com/prysmaticlabs/prysm into cache-filtered-tree * Merge branch 'cache-filtered-tree' of git+ssh://github.com/prysmaticlabs/prysm into cache-filtered-tree
Part of #4509
This PR caches filtered block tree. Instead of calculating the filtered tree on the fly, the cache maintains the tree and update the tree when there's a new post state
The cache is gated by
--cache-filtered-block-tree
. Huge improvements on flame 👇Before:
After: