From ef0268d3f9c72da75c550d979153e48d8ced587d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:47:30 +0200 Subject: [PATCH] Limit number of rocksdb background threads --- nano/lib/rocksdbconfig.cpp | 2 +- nano/lib/rocksdbconfig.hpp | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nano/lib/rocksdbconfig.cpp b/nano/lib/rocksdbconfig.cpp index e1ec644b6f..a12605d1f7 100644 --- a/nano/lib/rocksdbconfig.cpp +++ b/nano/lib/rocksdbconfig.cpp @@ -6,7 +6,7 @@ nano::error nano::rocksdb_config::serialize_toml (nano::tomlconfig & toml) const { toml.put ("enable", enable, "Whether to use the RocksDB backend for the ledger database.\ntype:bool"); toml.put ("memory_multiplier", memory_multiplier, "This will modify how much memory is used represented by 1 (low), 2 (medium), 3 (high). Default is 2.\ntype:uint8"); - toml.put ("io_threads", io_threads, "Number of threads to use with the background compaction and flushing. Number of hardware threads is recommended.\ntype:uint32"); + toml.put ("io_threads", io_threads, "Number of threads to use with the background compaction and flushing.\ntype:uint32"); return toml.get_error (); } diff --git a/nano/lib/rocksdbconfig.hpp b/nano/lib/rocksdbconfig.hpp index 20c0f8768d..232d320193 100644 --- a/nano/lib/rocksdbconfig.hpp +++ b/nano/lib/rocksdbconfig.hpp @@ -17,14 +17,15 @@ class rocksdb_config final enable{ using_rocksdb_in_tests () } { } - nano::error serialize_toml (nano::tomlconfig & toml_a) const; - nano::error deserialize_toml (nano::tomlconfig & toml_a); + + nano::error serialize_toml (nano::tomlconfig &) const; + nano::error deserialize_toml (nano::tomlconfig &); /** To use RocksDB in tests make sure the environment variable TEST_USE_ROCKSDB=1 is set */ static bool using_rocksdb_in_tests (); bool enable{ false }; uint8_t memory_multiplier{ 2 }; - unsigned io_threads{ nano::hardware_concurrency () }; + unsigned io_threads{ std::max (nano::hardware_concurrency () / 2, 1u) }; }; }