perf: batch UTXO set writes during IBD (issue #768)#781
Open
LiveLaughLove13 wants to merge 5 commits intokaspanet:masterfrom
Open
perf: batch UTXO set writes during IBD (issue #768)#781LiveLaughLove13 wants to merge 5 commits intokaspanet:masterfrom
LiveLaughLove13 wants to merge 5 commits intokaspanet:masterfrom
Conversation
Contributor
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
requested changes
Dec 10, 2025
Collaborator
coderofstuff
left a comment
There was a problem hiding this comment.
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).
D-Stacks
reviewed
Jan 13, 2026
|
|
||
| // 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 { |
Collaborator
There was a problem hiding this comment.
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.
Collaborator
There was a problem hiding this comment.
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.
Contributor
Author
There was a problem hiding this comment.
Understood, I can stop this PR then correct. Just want to verify
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.