0

I'm using RocksDB in my project with the SpringBoot Microservices. For monitoring & troubleshooting purposes, I want to export RocksDB metrics daily. I have exposed some metrics like Column Family, Estimated Counts, RocksDB Properties, etc. Now I want to expose a few more metrics like memory usage, cache details, RocksDB hit count, etc.

In the RocksDB wiki, I found - Memory Usage in RocksDB

Is there any way to expose these metrics?

Thanks

WizKid
  • 4,888
  • 2
  • 23
  • 23
Luffy
  • 186
  • 2
  • 14

1 Answers1

1

memory usage

The WIKI you pointed has good metrics you can start with. If you already exposed "RocksDB Properties" as you mentioned, then you can do the same with those by calling db->getProperty()

cache details, RocksDB hit count

Depending on what details you want, you can look into at least two places: kBlockCacheEntryStats in db properties https://github.com/facebook/rocksdb/blob/main/include/rocksdb/db.h#L979-L987 or cache related statistics in https://github.com/facebook/rocksdb/blob/main/include/rocksdb/statistics.h (search "cache"). Statistics are exposed by Statistics::getTickerCount or Statistics::histogramData()

etc.

For others, please refer to db.h (properties section https://github.com/facebook/rocksdb/blob/main/include/rocksdb/db.h#L921), statistics.h (https://github.com/facebook/rocksdb/blob/main/monitoring/statistics.h), perf_context.h (https://github.com/facebook/rocksdb/blob/main/include/rocksdb/perf_context.h) files for more

hx235
  • 56
  • 1
  • Hello @hx235, I am able to fetch stats using statistics & properties but most of them have 0 value. For example, BLOCK_CACHE_INDEX_HIT, BLOCK_CACHE_INDEX_MISS, BLOCK_CACHE_FILTER_HIT, BLOCK_CACHE_FILTER_MISS, etc. I need memory usage, cache hit/miss count, IO count, etc. – Luffy Aug 21 '23 at 07:39
  • Please ensure your statistics is enabled correctly by setting the correct options options.statistics = ROCKSDB_NAMESPACE::CreateDBStatistics(); Also please make sure the stats you are trying to obtain is expected to have value. For example, block cache, index and filter are indeed enabled. – hx235 Aug 24 '23 at 16:40