Update RocksDB default block cache size (#4132)

* Update RocksDB default block cache size.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
pull/4136/head
ahamlat 2 years ago committed by GitHub
parent a08ee362ac
commit 915854cfe1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/configuration/RocksDBCLIOptions.java
  2. 6
      plugins/rocksdb/src/main/java/org/hyperledger/besu/plugin/services/storage/rocksdb/segmented/RocksDBColumnarKeyValueStorage.java

@ -20,7 +20,7 @@ import picocli.CommandLine;
public class RocksDBCLIOptions { public class RocksDBCLIOptions {
public static final int DEFAULT_MAX_OPEN_FILES = 1024; 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_MAX_BACKGROUND_COMPACTIONS = 4;
public static final int DEFAULT_BACKGROUND_THREAD_COUNT = 4; public static final int DEFAULT_BACKGROUND_THREAD_COUNT = 4;
@ -42,7 +42,7 @@ public class RocksDBCLIOptions {
@CommandLine.Option( @CommandLine.Option(
names = {CACHE_CAPACITY_FLAG}, names = {CACHE_CAPACITY_FLAG},
hidden = true, hidden = true,
defaultValue = "8388608", defaultValue = "134217728",
paramLabel = "<LONG>", paramLabel = "<LONG>",
description = "Cache capacity of RocksDB (default: ${DEFAULT-VALUE})") description = "Cache capacity of RocksDB (default: ${DEFAULT-VALUE})")
long cacheCapacity; long cacheCapacity;

@ -66,6 +66,8 @@ public class RocksDBColumnarKeyValueStorage
private static final Logger LOG = LoggerFactory.getLogger(RocksDBColumnarKeyValueStorage.class); private static final Logger LOG = LoggerFactory.getLogger(RocksDBColumnarKeyValueStorage.class);
private static final String DEFAULT_COLUMN = "default"; private static final String DEFAULT_COLUMN = "default";
private static final String NO_SPACE_LEFT_ON_DEVICE = "No space left on device"; 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 { static {
RocksDbUtil.loadNativeLibrary(); RocksDbUtil.loadNativeLibrary();
@ -151,10 +153,10 @@ public class RocksDBColumnarKeyValueStorage
final LRUCache cache = new LRUCache(config.getCacheCapacity()); final LRUCache cache = new LRUCache(config.getCacheCapacity());
return new BlockBasedTableConfig() return new BlockBasedTableConfig()
.setBlockCache(cache) .setBlockCache(cache)
.setFormatVersion(5) .setFormatVersion(ROCKSDB_FORMAT_VERSION)
.setOptimizeFiltersForMemory(true) .setOptimizeFiltersForMemory(true)
.setCacheIndexAndFilterBlocks(true) .setCacheIndexAndFilterBlocks(true)
.setBlockSize(32768); .setBlockSize(ROCKSDB_BLOCK_SIZE);
} }
@Override @Override

Loading…
Cancel
Save