Skip to content

Commit

Permalink
eliminate some obviously useless threading
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Pyattaev committed Dec 28, 2024
1 parent e063c19 commit c6c5abb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ledger/src/blockstore_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ impl Rocks {
options.set_write_buffer_size(1024 * 1024);
// Disable compactions to avoid any modifications to the column
options.set_disable_auto_compactions(true);
options.set_max_background_jobs(4);
options.increase_parallelism(4);
cf_descriptors.push(ColumnFamilyDescriptor::new(cf_name, options));
}
});
Expand Down Expand Up @@ -1998,15 +2000,14 @@ fn get_db_options(access_type: &AccessType) -> Options {
options.create_if_missing(true);
options.create_missing_column_families(true);

// Per the docs, a good value for this is the number of cores on the machine
options.increase_parallelism(num_cpus::get() as i32);

// RocksDB is basically never bottlenecked on reasonable hardware, so 4 threads is enough
options.increase_parallelism(4);
let mut env = rocksdb::Env::new().unwrap();
// While a compaction is ongoing, all the background threads
// could be used by the compaction. This can stall writes which
// need to flush the memtable. Add some high-priority background threads
// which can service these writes.
env.set_high_priority_background_threads(4);
env.set_high_priority_background_threads(2);
options.set_env(&env);

// Set max total wal size to 4G.
Expand Down

0 comments on commit c6c5abb

Please sign in to comment.