From 9042614b27796e941d8e633cbf6e15b745ea49bd Mon Sep 17 00:00:00 2001 From: Alvaro Alda Date: Thu, 4 Apr 2019 10:45:57 +0200 Subject: [PATCH] Activate partitioned index filters. Reduce number of open files. --- storage/rocks/rocksdb_store.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/rocks/rocksdb_store.go b/storage/rocks/rocksdb_store.go index 235a4ce08..40faba516 100644 --- a/storage/rocks/rocksdb_store.go +++ b/storage/rocks/rocksdb_store.go @@ -89,7 +89,7 @@ func NewRocksDBStoreOpts(opts *Options) (*RocksDBStore, error) { globalOpts := rocksdb.NewDefaultOptions() globalOpts.SetCreateIfMissing(true) globalOpts.SetCreateIfMissingColumnFamilies(true) - //globalOpts.SetMaxOpenFiles() + globalOpts.SetMaxOpenFiles(100) globalOpts.SetEnv(env) // We build a LRU cache with a high pool ratio of 0.4 (40%). The lower pool // will cache data blocks and the higher will cache index and filters. @@ -152,7 +152,7 @@ func getHyperCacheTableOpts(blockCache *rocksdb.Cache) *rocksdb.Options { // touched on every operation. bbto := rocksdb.NewDefaultBlockBasedTableOptions() - bbto.SetFilterPolicy(rocksdb.NewBloomFilterPolicy(10)) + bbto.SetFilterPolicy(rocksdb.NewFullBloomFilterPolicy(10)) // In order to have a fine-grained control over the memory usage // we cache SST's index and filters in the block cache. The alternative // would be to leave RocksDB keep those files memory mapped, but @@ -163,6 +163,9 @@ func getHyperCacheTableOpts(blockCache *rocksdb.Cache) *rocksdb.Options { // those from L0 and move them to the high priority pool. bbto.SetPinL0FilterAndIndexBlocksInCache(true) bbto.SetCacheIndexAndFilterBlocksWithHighPriority(true) + bbto.SetPinTopLevelIndexAndFilterInCache(true) + bbto.SetPartitionFilters(true) + bbto.SetIndexType(rocksdb.KTwoLevelIndexSearchIndexType) bbto.SetBlockCache(blockCache) // increase block size to 16KB bbto.SetBlockSize(16 * 1024)