-
Notifications
You must be signed in to change notification settings - Fork 4.6k
TransactionScheduler: Clean already processed or old transactions from container #34233
Conversation
0c61b4c
to
fb2acf3
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #34233 +/- ##
=======================================
Coverage 81.9% 81.9%
=======================================
Files 819 819
Lines 219387 219448 +61
=======================================
+ Hits 179690 179785 +95
+ Misses 39697 39663 -34 |
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.
lgtm - believe thread local MI scheduler also frequently checks and drops expired/processed tx out of queue. Just a small question regarding how frequently it could be performed. The question does not need to block the PR's merge.
let (_, clean_time_us) = measure_us!(self.clean_queue()); | ||
saturating_add_assign!(self.timing_metrics.clean_time_us, clean_time_us); | ||
} | ||
BufferedPacketsDecision::Hold => {} |
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.
nice to drop expired or processed txs when getting close to becoming leader. Assume doing so only when ForwardAndHold
but not Hold
is due to performance concerns? Depends on clean_time_us
, maybe can do queue cleaning more frequently to avoid scheduler spending too much time on cleaning instead of receiving when close to be leader.
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.
Yeah, so Hold
can happen for a few reasons, one of which is it's our leader slot but the bank isn't ready yet. In that case, you'd expect to get the bank really soon, so we don't really want to do anything until the bank is there and we can schedule.
Previously, the TLMI (thread-local multi-iterator) would filter during ForwardAndHold
before forwarding. So this PR is kind of re-introducing that behavior, but just not forwarding.
const MAX_TRANSACTION_CHECKS: usize = 10_000; | ||
let mut transaction_ids = Vec::with_capacity(MAX_TRANSACTION_CHECKS); | ||
|
||
while let Some(id) = self.container.pop() { |
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.
just curious, could continer.size > MAX_TRANSACTION_CHECKS?
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.
Yeah, it could be. My intent here was to keep the runtime of this fn very short by only cleaning the top-of-queue, i.e. only trnasactions we're very likely to schedule early on during leader slot.
Problem
Summary of Changes
Blocked by #34232
Fixes #