Skip to content

Commit

Permalink
Update RocksDB default block cache size (hyperledger#4132)
Browse files Browse the repository at this point in the history
* Update RocksDB default block cache size.

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
  • Loading branch information
ahamlat authored Jul 19, 2022
1 parent a08ee36 commit 915854c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
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;

Expand All @@ -42,7 +42,7 @@ public class RocksDBCLIOptions {
@CommandLine.Option(
names = {CACHE_CAPACITY_FLAG},
hidden = true,
defaultValue = "8388608",
defaultValue = "134217728",
paramLabel = "<LONG>",
description = "Cache capacity of RocksDB (default: ${DEFAULT-VALUE})")
long cacheCapacity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -151,10 +153,10 @@ private BlockBasedTableConfig createBlockBasedTableConfig(final RocksDBConfigura
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
Expand Down

0 comments on commit 915854c

Please sign in to comment.