From 915854cfe1541a3dd02579ac7efa84f41ab5c0e2 Mon Sep 17 00:00:00 2001 From: ahamlat Date: Tue, 19 Jul 2022 17:37:53 +0200 Subject: [PATCH] Update RocksDB default block cache size (#4132) * Update RocksDB default block cache size. Signed-off-by: Ameziane H --- .../storage/rocksdb/configuration/RocksDBCLIOptions.java | 4 ++-- .../rocksdb/segmented/RocksDBColumnarKeyValueStorage.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBCLIOptions.java b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBCLIOptions.java index 68c37ca473..a919330b02 100644 --- a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBCLIOptions.java +++ b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBCLIOptions.java @@ -20,7 +20,7 @@ import picocli.CommandLine; public class RocksDBCLIOptions { public static final int DEFAULT_MAX_OPEN_FILES = 1024; - public static final long DEFAULT_CACHE_CAPACITY = 8388608; + public static final long DEFAULT_CACHE_CAPACITY = 134217728; public static final int DEFAULT_MAX_BACKGROUND_COMPACTIONS = 4; public static final int DEFAULT_BACKGROUND_THREAD_COUNT = 4; @@ -42,7 +42,7 @@ public class RocksDBCLIOptions { @CommandLine.Option( names = {CACHE_CAPACITY_FLAG}, hidden = true, - defaultValue = "8388608", + defaultValue = "134217728", paramLabel = "", description = "Cache capacity of RocksDB (default: ${DEFAULT-VALUE})") long cacheCapacity; diff --git a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java index 3991d79921..f8d7852dcd 100644 --- a/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java +++ b/plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java @@ -66,6 +66,8 @@ public class RocksDBColumnarKeyValueStorage private static final Logger LOG = LoggerFactory.getLogger(RocksDBColumnarKeyValueStorage.class); private static final String DEFAULT_COLUMN = "default"; private static final String NO_SPACE_LEFT_ON_DEVICE = "No space left on device"; + private static final int ROCKSDB_FORMAT_VERSION = 5; + private static final long ROCKSDB_BLOCK_SIZE = 32768; static { RocksDbUtil.loadNativeLibrary(); @@ -151,10 +153,10 @@ public class RocksDBColumnarKeyValueStorage final LRUCache cache = new LRUCache(config.getCacheCapacity()); return new BlockBasedTableConfig() .setBlockCache(cache) - .setFormatVersion(5) + .setFormatVersion(ROCKSDB_FORMAT_VERSION) .setOptimizeFiltersForMemory(true) .setCacheIndexAndFilterBlocks(true) - .setBlockSize(32768); + .setBlockSize(ROCKSDB_BLOCK_SIZE); } @Override