Limit number of rocksdb background threads (#4660)

This commit is contained in:
Piotr Wójcik 2024-06-28 10:48:31 +02:00 committed by GitHub
commit f7232cd0dc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View file

@ -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 ();
}

View file

@ -17,14 +17,15 @@ public:
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) };
};
}