RocksDB
Embeddable LSM-tree key-value library used as the storage engine inside many distributed databases.
What it is
An embeddable key-value store built on a log-structured merge tree, dual licensed Apache-2.0 and GPL-2.0. It is a library, not a server, and is most often encountered as the storage engine inside something else — MyRocks, YugabyteDB's DocDB, Kafka Streams state stores and many more.
Architecture
Writes go to a memtable and a write-ahead log, flush to immutable SSTables at level 0, and are merged upward by background compaction. Bloom filters and a block cache bound read cost. Column families provide independent keyspaces sharing one WAL.
Best use cases
- As the storage layer inside a database or stateful service you are building.
- Local state for stream processing, where ordered key-value access with snapshots is the requirement.
- Write-heavy embedded workloads where LSM write behaviour is a good fit.
- Understanding and tuning the systems that embed it.
When not to use it
- As a database. There is no query language, no schema, no secondary indexes, no network protocol, no replication and no access control — all of that is your code.
- When a relational interface is what you actually want; SQLite is the better embedded choice.
- For read-heavy point-lookup workloads where a B-tree engine would do less work.
Data model
Ordered byte keys mapped to byte values, with prefix iteration, snapshots, atomic write batches and optional transactions. Composite keys, indexes and any structure above that are the application's responsibility.
Consistency and transactions
Atomic write batches, plus optimistic and pessimistic transaction implementations. Durability depends on whether the WAL is fsynced, which is a configurable trade as elsewhere.
Scaling model
Single process, single machine. Scaling beyond that is the job of whatever system embeds it.
Replication
None. Systems built on RocksDB implement their own — Raft in YugabyteDB, binlog replication in MyRocks.
Backup and recovery
Checkpoint and backup engine APIs, which produce a consistent snapshot. Copying the directory while the process runs does not.
Monitoring
Properties exposed through the API — pending compaction bytes, level-0 file count, block cache
usage, write stall duration — plus the LOG file in the database directory, which records
compaction and flush events with timings.
Common mistakes
Production checklist
See Production Considerations.