Skip to content
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

Fine-tune DB parameters for block transaction storage #398

Open
coderofstuff opened this issue Jan 18, 2024 · 0 comments · May be fixed by #426
Open

Fine-tune DB parameters for block transaction storage #398

coderofstuff opened this issue Jan 18, 2024 · 0 comments · May be fixed by #426

Comments

@coderofstuff
Copy link
Collaborator

coderofstuff commented Jan 18, 2024

Tracking for: https://discord.com/channels/599153230659846165/917551031259377664/1196165330985308170

Problem Statement

Current tn11 nodes perform around 10x write more than actual disk size, and block txs are by far the most significant part of this storage

Look into storing block transactions in rocksdb with special settings that will prevent writing amplification.

Dev Notes

  • Consider: It's possible that column families can be used to specify settings for a specific area.
  • RocksDB has extensive documentation sites but they require study time
  • Examine the comments in the snippet:
impl ConnBuilder<PathBuf, false, Unspecified, i32> {
    pub fn build(self) -> Result<Arc<DB>, kaspa_utils::fd_budget::Error> {
        let (opts, guard) = default_opts!(self)?;

        // These look like universal compaction settings. We should start with checking out these. If they help
        // to reduce writing amplification but degrade performance, then we should look at applying settings on
        // the column family level. See below 
        rocksdb::UniversalCompactOptions:: ...
        opts.set_universal_compaction_options(uco)

        let db = Arc::new(DB::new(<DBWithThreadMode<MultiThreaded>>::open(&opts, self.db_path.to_str().unwrap()).unwrap(), guard));

        // These look like settings specific to a column family. If the above universal ones are too aggressive, we can check this out. 
        // However note that switching a store such as block txs to a column family might require some infra-level code changes, for instance
        // for figuring out how does one make a batch write combined with a column family store, as well as writing DB upgrade logic etc
        // (upper-level store wrapping old and new store and falling back to old if new is missing the entry)
        rocksdb::CompactOptions:: ...
        db.compact_range_cf_opt(cf, start, end, opts)

        Ok(db)
    }
}
@coderofstuff coderofstuff changed the title Fine-tune DB parameters Fine-tune DB parameters for block transaction storage Jan 18, 2024
@biryukovmaxim biryukovmaxim linked a pull request Feb 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants