Skip to content

Conversation

@LiveLaughLove13
Copy link
Contributor

  • 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
Copy link
Collaborator

@coderofstuff coderofstuff left a 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 {
Copy link
Collaborator

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.

Copy link
Collaborator

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IBD: Batch UTXO set writes

3 participants