-
Notifications
You must be signed in to change notification settings - Fork 260
perf: batch UTXO set writes during IBD (issue #768) #781
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
base: master
Are you sure you want to change the base?
perf: batch UTXO set writes during IBD (issue #768) #781
Conversation
LiveLaughLove13
commented
Dec 10, 2025
- Add write_many_batch() method using BatchDbWriter instead of DirectDbWriter
- Skip cache updates during batch writes for better performance
- Integrate batch writing into IBD UTXO import (batch every 50 chunks)
- Reduces database write operations significantly during IBD
- Fixes: IBD: Batch UTXO set writes #768
- Add write_many_batch() method using BatchDbWriter instead of DirectDbWriter - Skip cache updates during batch writes for better performance - Integrate batch writing into IBD UTXO import (batch every 50 chunks) - Reduces database write operations significantly during IBD - Fixes: kaspanet#768
coderofstuff
left a comment
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.
After applying the tests, run this against mainnet and make sure to verify that IBD still completes.
…e correct location (append_imported_pruning_point_utxos), and revert an incorrect batching implementation added to virtual UTXO import. Run cargo fmt and ensure clippy is clean. What changed Consensus pruning meta UTXO import Updated Consensus::append_imported_pruning_point_utxos to write imported UTXOs via RocksDB WriteBatch using utxo_set.write_many_batch(...) followed by db.write(batch). Drops the pruning meta write lock before MuHash computation (no functional change to multiset logic; reduces lock hold time). Virtual pruning point UTXO copy Reverted the chunk/batching logic in VirtualStateProcessor::import_pruning_point_utxo_set back to the original per-chunk write_from_iterator_without_cache behavior (maintainer indicated the batching change did not belong here).
|
|
||
| // Log progress every 10,000 chunks or every 5 seconds, whichever comes first | ||
| let now = std::time::Instant::now(); | ||
| if chunk_count % 10000 == 0 || now.duration_since(last_log_time).as_secs() >= 5 { |
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.
personally i feel there is no need to log by chunk amount, I'd rather just stay time-based. It'll give it more consistency, and stop it from hogging the log output on potentially very fast machines.
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.
Remove all the changes in this file. There's no reason for it to be changed w.r.t. the performance update being made elsewhere.
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.
Understood, I can stop this PR then correct. Just want to verify