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
Prefetch earlier in apply and pipeline it #11083
base: master
Are you sure you want to change the base?
Conversation
18e6ba9
to
f2357fc
Compare
f2357fc
to
b42ecbd
Compare
// Retrieve delayed receipts to initiate prefetching during local receipt processing. | ||
// TODO add time to delayed receipt processing metric. |
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.
why don't we do this at the beginning of apply
?
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.
The processing order is transactions -> local_receipts -> delayed_receipts
where local receipts become available only as transactions are processed. The prefetcher's work queue is FIFO which implies prefetching should happen in the same order as processing. If delayed receipts were prefetched out of order (e.g. at the beginning), it could get in the way of prefetching for local receipts.
Making the prefetcher have a work queue with priorities was brought up, but it's a bigger change.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #11083 +/- ##
==========================================
+ Coverage 71.02% 71.03% +0.01%
==========================================
Files 773 773
Lines 154349 154421 +72
Branches 154349 154421 +72
==========================================
+ Hits 109630 109700 +70
- Misses 40270 40271 +1
- Partials 4449 4450 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
} | ||
|
||
// TODO remove `look_ahead_len` here, instead just prefetch one next receipt. less edge cases. | ||
impl PrefetchManager { |
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.
can this data and logic be just part of the TriePrefetcher instead of having a separate manager on top of it? I see the TriePrefetcher is already aware of receipts and transactions and it can be aware of types of receipts as well (local, delayed, incoming)?
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.
PrefetchManager is scoped to an invocation of fn apply
, while TriePrefetcher is scoped to the transaction runtime, which I think is a broader scope. My interpretation is that integrating PrefetchManager functionality into TriePrefetcher would require limiting TriePrefetcher's scope to a particular fn apply
invocation as well.
The current PrefetchManager turned out to be a suboptimal abstraction and I'm working on some changes of how delayed receipts are handled. If this results in a performance improvement and the PR is not discarded, I'll consider moving things into TriePrefetcher.
Changes
apply
to invoke prefetching of data required for receipts earlier. The aim is to have prefetched data available by the time the corresponding receipt is processed, see #11002.Current status
Lookahead related bookkeeping is done in
PrefetchManager
to avoid adding more logic intoapply
itself. Though the current implementation ofPrefetchManager
turned out to be a poor abstraction as different kind of receipts (local, delayed, incoming) are handled differently.Before fixing that I'd like to first measure if prefetching earlier actually yields a performance improvement. If it doesn't, there would be no point in reworking
PerformanceManager
.