diff --git a/crates/walrus-service/node_config_example.yaml b/crates/walrus-service/node_config_example.yaml index e482d26211..5c666127cd 100644 --- a/crates/walrus-service/node_config_example.yaml +++ b/crates/walrus-service/node_config_example.yaml @@ -8,7 +8,8 @@ db_config: keep_log_file_num: 50 wal_ttl_seconds: 172800 wal_size_limit_mb: 10240 - enable_statistics: false + max_background_jobs: 16 + enable_statistics: true use_optimistic_transaction_db: true standard: enable_blob_files: false diff --git a/crates/walrus-service/src/node/storage/database_config.rs b/crates/walrus-service/src/node/storage/database_config.rs index 5fff4f6012..989649f15d 100644 --- a/crates/walrus-service/src/node/storage/database_config.rs +++ b/crates/walrus-service/src/node/storage/database_config.rs @@ -228,6 +228,8 @@ pub struct GlobalDatabaseOptions { pub wal_ttl_seconds: Option, /// The size limit for the WAL in MB. pub wal_size_limit_mb: Option, + /// The maximum number of background jobs (compactions + flushes). + pub max_background_jobs: Option, /// Whether to enable statistics. pub enable_statistics: bool, /// If true, databases are opened using `OptimisticTransactionDB` instead of the standard DB. @@ -244,7 +246,8 @@ impl Default for GlobalDatabaseOptions { keep_log_file_num: Some(50), wal_ttl_seconds: Some(60 * 60 * 24 * 2), // 2 days, wal_size_limit_mb: Some(10 * 1024), // 10 GB, - enable_statistics: false, + max_background_jobs: Some(16), + enable_statistics: true, use_optimistic_transaction_db: true, } } @@ -282,6 +285,10 @@ impl From<&GlobalDatabaseOptions> for Options { options.set_wal_size_limit_mb(wal_size_limit_mb); } + if let Some(max_background_jobs) = value.max_background_jobs { + options.set_max_background_jobs(max_background_jobs); + } + if value.enable_statistics { options.enable_statistics(); options.set_statistics_level(StatsLevel::ExceptHistogramOrTimers);