Database / RocksDB Basics Interview Questions
Describe the Write Path in RocksDB?
- An application calls Put, Delete, or Merge with a key and, if applicable, a value
- The write is appended to the Write-Ahead Log on disk, for durability
- The write is also applied to the active MemTable in memory
- Once the MemTable reaches its size limit, it's marked immutable, and a new MemTable takes over for future writes
- A background thread flushes the immutable MemTable to disk as a new Level-0 SSTable
- Background compaction later merges that SSTable with others as part of RocksDB's ongoing housekeeping
Because the application-facing part of this path, steps one through three, only touches memory and a sequential log, writes can complete quickly without waiting on the slower, more complex compaction process happening in the background.
More Related questions...