Skip to content

Commit b7a58c1

Browse files
halfpricemlegner
andauthored
fix: increase RocksDB background threads (#3156)
* increase RocksDB background threads * update example config --------- Co-authored-by: Markus Legner <markus@mystenlabs.com>
1 parent f3b9360 commit b7a58c1

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

crates/walrus-service/node_config_example.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ db_config:
88
keep_log_file_num: 50
99
wal_ttl_seconds: 172800
1010
wal_size_limit_mb: 10240
11-
enable_statistics: false
11+
max_background_jobs: 16
12+
enable_statistics: true
1213
use_optimistic_transaction_db: true
1314
standard:
1415
enable_blob_files: false

crates/walrus-service/src/node/storage/database_config.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ pub struct GlobalDatabaseOptions {
228228
pub wal_ttl_seconds: Option<u64>,
229229
/// The size limit for the WAL in MB.
230230
pub wal_size_limit_mb: Option<u64>,
231+
/// The maximum number of background jobs (compactions + flushes).
232+
pub max_background_jobs: Option<i32>,
231233
/// Whether to enable statistics.
232234
pub enable_statistics: bool,
233235
/// If true, databases are opened using `OptimisticTransactionDB` instead of the standard DB.
@@ -244,7 +246,8 @@ impl Default for GlobalDatabaseOptions {
244246
keep_log_file_num: Some(50),
245247
wal_ttl_seconds: Some(60 * 60 * 24 * 2), // 2 days,
246248
wal_size_limit_mb: Some(10 * 1024), // 10 GB,
247-
enable_statistics: false,
249+
max_background_jobs: Some(16),
250+
enable_statistics: true,
248251
use_optimistic_transaction_db: true,
249252
}
250253
}
@@ -282,6 +285,10 @@ impl From<&GlobalDatabaseOptions> for Options {
282285
options.set_wal_size_limit_mb(wal_size_limit_mb);
283286
}
284287

288+
if let Some(max_background_jobs) = value.max_background_jobs {
289+
options.set_max_background_jobs(max_background_jobs);
290+
}
291+
285292
if value.enable_statistics {
286293
options.enable_statistics();
287294
options.set_statistics_level(StatsLevel::ExceptHistogramOrTimers);

0 commit comments

Comments
 (0)