-
Notifications
You must be signed in to change notification settings - Fork 153
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
Optimize window cache building for ibd #576
base: master
Are you sure you want to change the base?
Optimize window cache building for ibd #576
Conversation
…-Stacks/rusty-kaspa into optimize-window-caches-for-ibd
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.
In the other PR #551 I noted that I've tested this to completion and observed hotspots related to window calc removed.
Minor comment left
consensus/src/pipeline/body_processor/body_validation_in_context.rs
Outdated
Show resolved
Hide resolved
slight comment update.
You have the test and benches in another branch. Any way we can get those into here in a form that makes sense to run regularly? |
I don't have unit tests per se, Just ones that compare and bench during runtime. The runtime cost is not trivial. Maybe it can be done behind the sanity tests flag? But even then it is a bit expensive. Also maybe worth mentioning, it would leave a decent code footprint, as old code would remain running in tandem to compare and bench. |
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.
I've tested the latest commit in TN11 and mainnet and both IBD and run fine
Background
Currently we Cache block windows during header processing, but rely on the cache in both block body processing, and virtual processing. A cache miss on the window cache results in a large overhead in re-constructing the windows. Specifically this results in significant processing overhead during IBD, where header, and body / virtual processing is not streamlined against each other.
This PR addresses, and patches this issue (thus far, only for tn11) by:
check_block_transactions_in_context
Tests and Benching
I currently have created a branch, here which checks the new and old build method against each other, and logs time spent building the block windows.
all window builds are passing asserts between old and new.
regarding benching, here is an excerpt, taken during IBD:
Note:
most of this performance increase is during block body IBD syncing, where the difficulty window is built, or more specifically on virtual resolve during IBD. but it also reduces time spent in
past_median_time
window by about 75% (from 16 secs to about 4 secs, on my machine).it doesn't factor in the parallelization and real-time gain during syncing.