If I use RocksDB without ColumnFamilies ~ db.get(key)
then the throughput is amazing 100_000+ op/sec
If I use ColumnFamilies ~ db.get(cfh, key)
then the throughput drops to 1000..10_000 op/sec
After very long consultations with AI, I made such configuration:
dbOptions = new DBOptions()
.setCreateIfMissing(true)
.setCreateMissingColumnFamilies(true)
.setMaxBackgroundJobs(Runtime.getRuntime().availableProcessors() * 2)
.setUseFsync(false)
.setUseDirectIoForFlushAndCompaction(true)
tableConfig = new BlockBasedTableConfig();
Cache blockCache = new LRUCache(512 * 1024 * 1024L, 8); // 512MB block cache, 8 shards
tableConfig.setBlockCache(blockCache);
tableConfig.setBlockCacheSize(512 * 1024 * 1024);//<^?
tableConfig.setCacheIndexAndFilterBlocks(true);
//tableConfig.setCacheIndexAndFilterBlocksWithHighPriority(true);
tableConfig.setBlockSize(16 * 1024);// Default: 4K
tableConfig.setFilterPolicy(new BloomFilter(10, false));
//tableConfig.setPartitionFilters(true); ? 40+ mi keys?
tableConfig.setMetadataBlockSize(4096);
return tableConfig;
options = new ColumnFamilyOptions()
.optimizeLevelStyleCompaction()
.setCompressionType(CompressionType.ZSTD_COMPRESSION)
.setBottommostCompressionType(CompressionType.ZSTD_COMPRESSION)
.setOptimizeFiltersForHits(true)
.setWriteBufferSize(writeBufferSize * 1024 * 1024)// 128 MB per CF
.setForceConsistencyChecks(true)
.setMaxWriteBufferNumber(4)
.setMinWriteBufferNumberToMerge(2);
.setTableFormatConfig(createTableConfig);
It is still noticeably slower than no-ColumnFamilies/single-default RocksDB.
Any ideas or tips? 😭🙏
If I use RocksDB without ColumnFamilies ~ db.get(key)
then the throughput is amazing 100_000+ op/sec
If I use ColumnFamilies ~ db.get(cfh, key)
then the throughput drops to 1000..10_000 op/sec
After very long consultations with AI, I made such configuration:
It is still noticeably slower than no-ColumnFamilies/single-default RocksDB.
Any ideas or tips? 😭🙏