From 90d90c46da4ab16cc3beafc4c1e93ceb3766ac4f Mon Sep 17 00:00:00 2001 From: strawberry Date: Mon, 4 Mar 2024 20:52:57 -0500 Subject: [PATCH] use get_physical for only physical core count Signed-off-by: strawberry --- conduwuit-example.toml | 4 ++-- src/config/mod.rs | 2 +- src/database/abstraction/rocksdb.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conduwuit-example.toml b/conduwuit-example.toml index de1a5b56..242f862c 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -256,8 +256,8 @@ allow_check_for_updates = true # Time in seconds before RocksDB will forcibly rotate logs. Defaults to 0. #rocksdb_log_time_to_roll = 0 -# Amount of threads that RocksDB will use for parallelism. Set to 0 to use all your CPUs. -# Defaults to your CPU count divided by 2 (half) +# Amount of threads that RocksDB will use for parallelism. Set to 0 to use all your physical cores. +# Defaults to your CPU physical core count (not logical threads) count divided by 2 (half) #rocksdb_parallelism_threads = 0 diff --git a/src/config/mod.rs b/src/config/mod.rs index 2cbcf9c0..7ad42f09 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -507,7 +507,7 @@ fn default_rocksdb_log_time_to_roll() -> usize { } fn default_rocksdb_parallelism_threads() -> usize { - num_cpus::get() / 2 + num_cpus::get_physical() / 2 } // I know, it's a great name diff --git a/src/database/abstraction/rocksdb.rs b/src/database/abstraction/rocksdb.rs index 35fb1207..5321e147 100644 --- a/src/database/abstraction/rocksdb.rs +++ b/src/database/abstraction/rocksdb.rs @@ -48,7 +48,7 @@ fn db_options(rocksdb_cache: &rocksdb::Cache, config: &Config) -> rocksdb::Optio }; let threads = if config.rocksdb_parallelism_threads == 0 { - num_cpus::get() // max CPUs if user specified 0 + num_cpus::get_physical() // max cores if user specified 0 } else { config.rocksdb_parallelism_threads };