Skip to content

Commit

Permalink
Apply some RocksDB documentation suggestions to reduce memory usage. (h…
Browse files Browse the repository at this point in the history
…yperledger#3985)

Signed-off-by: Ameziane H <ameziane.hamlat@consensys.net>
  • Loading branch information
ahamlat authored Jun 17, 2022
1 parent 5db69b7 commit 5702ca0
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ public RocksDBColumnarKeyValueStorage(
.map(
segment ->
new ColumnFamilyDescriptor(
segment.getId(), new ColumnFamilyOptions().setTtl(0)))
segment.getId(),
new ColumnFamilyOptions()
.setTtl(0)
.setTableFormatConfig(createBlockBasedTableConfig(configuration))))
.collect(Collectors.toList());
columnDescriptors.add(
new ColumnFamilyDescriptor(
Expand Down Expand Up @@ -146,7 +149,12 @@ public RocksDBColumnarKeyValueStorage(

private BlockBasedTableConfig createBlockBasedTableConfig(final RocksDBConfiguration config) {
final LRUCache cache = new LRUCache(config.getCacheCapacity());
return new BlockBasedTableConfig().setBlockCache(cache);
return new BlockBasedTableConfig()
.setBlockCache(cache)
.setFormatVersion(5)
.setOptimizeFiltersForMemory(true)
.setCacheIndexAndFilterBlocks(true)
.setBlockSize(32768);
}

@Override
Expand Down

0 comments on commit 5702ca0

Please sign in to comment.