From 83e0368eaa3eee8308ea3b5f10149b1d8690b059 Mon Sep 17 00:00:00 2001 From: Neethu Haneesha Bingi Date: Thu, 3 Mar 2022 15:14:37 -0800 Subject: [PATCH] RocksDB increasing background threads to speedup compaction. --- fdbclient/ServerKnobs.cpp | 3 ++- fdbclient/ServerKnobs.h | 1 + fdbserver/KeyValueStoreRocksDB.actor.cpp | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/fdbclient/ServerKnobs.cpp b/fdbclient/ServerKnobs.cpp index 7bddd42b2e..de3d6d5443 100644 --- a/fdbclient/ServerKnobs.cpp +++ b/fdbclient/ServerKnobs.cpp @@ -339,7 +339,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi init( REPLACE_CONTENTS_BYTES, 1e5 ); // KeyValueStoreRocksDB - init( ROCKSDB_BACKGROUND_PARALLELISM, 0 ); + init( ROCKSDB_BACKGROUND_PARALLELISM, 4 ); init( ROCKSDB_READ_PARALLELISM, 4 ); // Use a smaller memtable in simulation to avoid OOMs. int64_t memtableBytes = isSimulated ? 32 * 1024 : 512 * 1024 * 1024; @@ -366,6 +366,7 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi init( ROCKSDB_WRITE_RATE_LIMITER_AUTO_TUNE, true ); init( ROCKSDB_PERFCONTEXT_ENABLE, false ); if( randomize && BUGGIFY ) ROCKSDB_PERFCONTEXT_ENABLE = deterministicRandom()->coinflip() ? false : true; init( ROCKSDB_PERFCONTEXT_SAMPLE_RATE, 0.0001 ); + init( ROCKSDB_MAX_SUBCOMPACTIONS, 2 ); // Leader election bool longLeaderElection = randomize && BUGGIFY; diff --git a/fdbclient/ServerKnobs.h b/fdbclient/ServerKnobs.h index bb7fb03a62..cfe6c8d4d1 100644 --- a/fdbclient/ServerKnobs.h +++ b/fdbclient/ServerKnobs.h @@ -297,6 +297,7 @@ public: bool ROCKSDB_WRITE_RATE_LIMITER_AUTO_TUNE; bool ROCKSDB_PERFCONTEXT_ENABLE; // Enable rocks perf context metrics. May cause performance overhead double ROCKSDB_PERFCONTEXT_SAMPLE_RATE; + int ROCKSDB_MAX_SUBCOMPACTIONS; // Leader election int MAX_NOTIFICATIONS; diff --git a/fdbserver/KeyValueStoreRocksDB.actor.cpp b/fdbserver/KeyValueStoreRocksDB.actor.cpp index 090256df0e..1e966b8b9b 100644 --- a/fdbserver/KeyValueStoreRocksDB.actor.cpp +++ b/fdbserver/KeyValueStoreRocksDB.actor.cpp @@ -194,6 +194,9 @@ rocksdb::Options getOptions() { if (SERVER_KNOBS->ROCKSDB_BACKGROUND_PARALLELISM > 0) { options.IncreaseParallelism(SERVER_KNOBS->ROCKSDB_BACKGROUND_PARALLELISM); } + if (SERVER_KNOBS->ROCKSDB_MAX_SUBCOMPACTIONS > 0) { + options.max_subcompactions = SERVER_KNOBS->ROCKSDB_MAX_SUBCOMPACTIONS; + } options.statistics = rocksdb::CreateDBStatistics(); options.statistics->set_stats_level(rocksdb::kExceptHistogramOrTimers);