2

We are opening multiple rocksdb instances into a single process and they are all accessed equally. When using BlockBasedTableOptions::block_cache is there any benefit allocating a single large cache over several smaller caches?

With NewLRUCache it appears that the num_shard_bits allows a single large shared cache to reduce the resource contention just like having multiple smaller caches each with no sharding. From the outside they appear equal.

Edit

I think it best for someone to close/delete. There isn't a programing answer to this question. I was attempting to understand conceptually how rocksdb works. This is a question for the rocksdb Google Group not SO.

Platypi
  • 29
  • 2
  • When *you* tested / benchmarked this (the different options), what did that tell you? – Jesper Juhl May 21 '20 at 16:28
  • @JesperJuhl I'm looking for insight beyond cycle counts and memory usage to understand why one would choose a shared vs separate caches when usage of all database instances are equal. – Platypi May 22 '20 at 17:27

1 Answers1

0

A Cache object can be shared by multiple RocksDB instances in the same process, allowing users to control the overall cache capacity.

https://github.com/facebook/rocksdb/wiki/Block-Cache

Nikita
  • 1
  • Please add some code as to how this can help the OP achieve their goal. https://stackoverflow.com/how-to-answer – Marcello B. Jul 15 '20 at 18:38