@@ -340,8 +340,7 @@ rocksdb::ColumnFamilyOptions getCFOptions() {
340340 options.prefix_extractor .reset (rocksdb::NewFixedPrefixTransform (SERVER_KNOBS->ROCKSDB_PREFIX_LEN ));
341341
342342 // Also turn on bloom filters in the memtable.
343- // TODO: Make a knob for this as well.
344- options.memtable_prefix_bloom_size_ratio = 0.1 ;
343+ options.memtable_prefix_bloom_size_ratio = SERVER_KNOBS->ROCKSDB_MEMTABLE_PREFIX_BLOOM_SIZE_RATIO ;
345344
346345 // 5 -- Can be read by RocksDB's versions since 6.6.0. Full and partitioned
347346 // filters use a generally faster and more accurate Bloom filter
@@ -352,11 +351,11 @@ rocksdb::ColumnFamilyOptions getCFOptions() {
352351 // Create and apply a bloom filter using the 10 bits
353352 // which should yield a ~1% false positive rate:
354353 // https://github.com/facebook/rocksdb/wiki/RocksDB-Bloom-Filter#full-filters-new-format
355- bbOpts.filter_policy .reset (rocksdb::NewBloomFilterPolicy (10 ));
354+ bbOpts.filter_policy .reset (rocksdb::NewBloomFilterPolicy (SERVER_KNOBS-> ROCKSDB_BLOOM_BITS_PER_KEY ));
356355
357356 // The whole key blooms are only used for point lookups.
358357 // https://github.com/facebook/rocksdb/wiki/RocksDB-Bloom-Filter#prefix-vs-whole-key
359- bbOpts.whole_key_filtering = false ;
358+ bbOpts.whole_key_filtering = SERVER_KNOBS-> ROCKSDB_BLOOM_WHOLE_KEY_FILTERING ;
360359 }
361360
362361 if (SERVER_KNOBS->ROCKSDB_BLOCK_CACHE_SIZE > 0 ) {
@@ -369,6 +368,12 @@ rocksdb::ColumnFamilyOptions getCFOptions() {
369368 bbOpts.block_size = SERVER_KNOBS->ROCKSDB_BLOCK_SIZE ;
370369 }
371370
371+ // The readahead size starts with 8KB and is exponentially increased on each additional sequential IO,
372+ // up to a max of BlockBasedTableOptions.max_auto_readahead_size (default 256 KB)
373+ if (SERVER_KNOBS->ROCKSDB_MAX_AUTO_READAHEAD_SIZE > 0 ) {
374+ bbOpts.max_auto_readahead_size = SERVER_KNOBS->ROCKSDB_MAX_AUTO_READAHEAD_SIZE ;
375+ }
376+
372377 options.table_factory .reset (rocksdb::NewBlockBasedTableFactory (bbOpts));
373378
374379 return options;
@@ -411,13 +416,14 @@ struct Counters {
411416 Counter convertedDeleteKeyReqs;
412417 Counter convertedDeleteRangeReqs;
413418 Counter rocksdbReadRangeQueries;
419+ Counter commitDelayed;
414420
415421 Counters ()
416422 : cc(" RocksDBThrottle" ), immediateThrottle(" ImmediateThrottle" , cc), failedToAcquire(" FailedToAcquire" , cc),
417423 deleteKeyReqs (" DeleteKeyRequests" , cc), deleteRangeReqs(" DeleteRangeRequests" , cc),
418424 convertedDeleteKeyReqs(" ConvertedDeleteKeyRequests" , cc),
419425 convertedDeleteRangeReqs(" ConvertedDeleteRangeRequests" , cc),
420- rocksdbReadRangeQueries(" RocksdbReadRangeQueries" , cc) {}
426+ rocksdbReadRangeQueries(" RocksdbReadRangeQueries" , cc), commitDelayed( " CommitDelayed " , cc) {}
421427};
422428
423429struct ReadIterator {
@@ -935,6 +941,8 @@ ACTOR Future<Void> rocksDBMetricLogger(UID id,
935941 { " RowCacheHit" , rocksdb::ROW_CACHE_HIT, 0 },
936942 { " RowCacheMiss" , rocksdb::ROW_CACHE_MISS, 0 },
937943 { " CountIterSkippedKeys" , rocksdb::NUMBER_ITER_SKIP, 0 },
944+ { " NoIteratorCreated" , rocksdb::NO_ITERATOR_CREATED, 0 },
945+ { " NoIteratorDeleted" , rocksdb::NO_ITERATOR_DELETED, 0 },
938946 };
939947
940948 // To control the rocksdb::StatsLevel, use ROCKSDB_STATS_LEVEL knob.
@@ -2119,9 +2127,12 @@ struct RocksDBKeyValueStore : IKeyValueStore {
21192127 &estPendCompactBytes);
21202128 while (count && estPendCompactBytes > SERVER_KNOBS->ROCKSDB_CAN_COMMIT_COMPACT_BYTES_LIMIT ) {
21212129 wait (delay (SERVER_KNOBS->ROCKSDB_CAN_COMMIT_DELAY_ON_OVERLOAD ));
2130+ ++self->counters .commitDelayed ;
21222131 count--;
21232132 self->db ->GetAggregatedIntProperty (rocksdb::DB::Properties::kEstimatePendingCompactionBytes ,
21242133 &estPendCompactBytes);
2134+ if (deterministicRandom ()->random01 () < 0.001 )
2135+ TraceEvent (SevWarn, " RocksDBCommitsDelayed1000x" , self->id );
21252136 }
21262137
21272138 return Void ();
0 commit comments