It is able to help users tune their current block cache size, and determine how efficient they are using the memory. Also, it helps understand the cache performance with fast storage.

Since SimCache is a wrapper on top of normal block cache. User has to create a block cache first with NewLRUCache:

  1. rocksdb::BlockBasedTableOptions bbt_opts;
  2. std::shared_ptr<rocksdb::Cache> sim_cache =
  3. NewSimCache(normal_block_cache,
  4. bbt_opts.block_cache = sim_cache;
  5. options.table_factory.reset(new BlockBasedTableFactory(bbt_opts));

Finally, open the DB with .Then the HIT/MISS value of SimCache can be acquired by calling and , respectively. Alternatively, if you don't want to store sim_cache and using Rocksdb (>= v4.12), you can get these statistics through Tickers SIM_BLOCK_CACHE_HIT and SIM_BLOCK_CACHE_MISS in .

sim_capacity * entry_size / (entry_size + block_size),

  • 76 <= entry_size (key_size + other) <= 104,