diff --git a/src/database/rocksdb/opts.rs b/src/database/rocksdb/opts.rs index 2c8b793c..ea4a0dea 100644 --- a/src/database/rocksdb/opts.rs +++ b/src/database/rocksdb/opts.rs @@ -22,7 +22,7 @@ pub(crate) fn db_options(config: &Config, env: &mut Env, row_cache: &Cache, col_ // Processing let threads = if config.rocksdb_parallelism_threads == 0 { - num_cpus::get() // max cores if user specified 0 + std::cmp::max(2, num_cpus::get()) // max cores if user specified 0 } else { config.rocksdb_parallelism_threads }; diff --git a/src/main.rs b/src/main.rs index af235146..bf2f40db 100644 --- a/src/main.rs +++ b/src/main.rs @@ -515,7 +515,7 @@ fn init(args: clap::Args) -> Result { .enable_io() .enable_time() .thread_name("conduwuit:worker") - .worker_threads(num_cpus::get()) + .worker_threads(std::cmp::max(2, num_cpus::get())) .build() .unwrap(),