Search code examples
rocksdb

multiple instances of rocksdb


On a multi-core server (or cluster) want to deploy a rocksdb db on each core that is independent of each other ie. not looking for a distributed db. Is this possible?

For each in-memory db, does it need to communicate with storage during runtime operations ie. not at startup or close down or are all db operations performed in-memory?


Solution

  • 1) Yes, it's possible. RocksDB is simply a C++ library which you can compile with your code that manages multiple rocksdb instances a multi-core server (or cluster). Multiple rocksdb instances can also share the same set of resources (such as sharing the same thread pool) by having them using the same Env (see Options::env).

    // Use the specified object to interact with the environment,
    // e.g. to read/write files, schedule background work, etc.
    // Default: Env::Default()
    Env* env;
    

    2) if the directory of your rocksdb instance is in memory (such as mounting via tmpfs), then all db operations are guaranteed to be performed in-memory. To make such rocksdb persistent, you can also optionally have write-ahead-log writing to some persistent storage like flash or disk.