Skip to content

Commit f4ff441

Browse files
committed
Further tune RocksDB options
1 parent ef947b2 commit f4ff441

File tree

5 files changed

+13
-2
lines changed

5 files changed

+13
-2
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ lru = "0.12.3"
121121
num-bigint = "0.4.3"
122122
num-format = "0.4.4"
123123
num-traits = "0.2.18"
124+
num_cpus = "1.16.0"
124125
octocrab = "0.42.1"
125126
oneshot = "0.1.6"
126127
pathdiff = "0.2.1"

examples/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

linera-views/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ linera-base.workspace = true
4545
linera-views-derive.workspace = true
4646
linera-witty.workspace = true
4747
linked-hash-map.workspace = true
48+
num_cpus.workspace = true
4849
prometheus.workspace = true
4950
rand = { workspace = true, features = ["small_rng"] }
5051
rocksdb = { workspace = true, optional = true }

linera-views/src/backends/rocks_db.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ const MAX_VALUE_SIZE: usize = 3221225072;
4949
// 8388608 and so for offset reason we decrease by 400
5050
const MAX_KEY_SIZE: usize = 8388208;
5151

52-
const DB_CACHE_SIZE: usize = 8 * 1024 * 1024; // 8 MiB
53-
const DB_MAX_WRITE_BUFFER_NUMBER: i32 = 16;
52+
const DB_CACHE_SIZE: usize = 128 * 1024 * 1024; // 128 MiB
53+
const DB_MAX_WRITE_BUFFER_NUMBER: i32 = 8;
5454

5555
/// The RocksDB client that we use.
5656
type DB = rocksdb::DBWithThreadMode<rocksdb::MultiThreaded>;
@@ -307,6 +307,13 @@ impl RocksDbStoreInternal {
307307
options.set_write_buffer_size(DB_CACHE_SIZE);
308308
options.set_max_write_buffer_number(DB_MAX_WRITE_BUFFER_NUMBER);
309309
options.set_compression_type(rocksdb::DBCompressionType::Lz4);
310+
options.set_level_zero_slowdown_writes_trigger(-1);
311+
options.set_level_zero_stop_writes_trigger(48);
312+
options.set_stats_dump_period_sec(60);
313+
options.enable_statistics();
314+
options.increase_parallelism(num_cpus::get() as i32);
315+
options.set_max_background_jobs(8);
316+
options.set_level_compaction_dynamic_level_bytes(true);
310317

311318
let db = DB::open(&options, path_buf)?;
312319
let executor = RocksDbStoreExecutor {

0 commit comments

Comments
 (0)