I have the case where multiple Linux processes need to link with RocksDB library and concurently read (high load) the same database.
The only one process updates database several times a day.
Is it possible to concurrently read from within multiple processes from RocksDB?
Unfortunately can't find this information over the Internet.
CodePudding user response:
https://github.com/facebook/rocksdb/wiki/Basic-Operations#concurrency indicates that:
A database may only be opened by one process at a time. The rocksdb implementation acquires a lock from the operating system to prevent misuse. Within a single process, the same rocksdb::DB object may be safely shared by multiple concurrent threads. I.e., different threads may write into or fetch iterators or call Get on the same database without any external synchronization (the rocksdb implementation will automatically do the required synchronization).
CodePudding user response:
Seems that Rocksdb supports multiple read-only or secondary instances (two variations of read-only mode):
Read-only Instance - Opens the database in read-only mode. When the Read-only instance is created, it gets a static read-only view of the Primary Instance’s database contents
Secondary Instance – Opens the database in read-only mode. Supports extra ability to dynamically catch-up with the Primary instance (through a manual call by the user – based on their delay/frequency requirements)
But only one read-write instance:
The Primary Instance is a regular RocksDB instance capable of read, write, flush and compaction. The Read-only and Secondary Instances supports read operations alone.
Only single instance of Primary is allowed; but many concurrent Read-only and Secondary Instances are allowed.