gitmyhub

rocksdb

C++ ★ 32k updated 11h ago

A library that provides an embeddable, persistent key-value store for fast storage.

Embeddable key-value storage library optimized for fast hardware like SSDs. Designed for high-throughput applications that need a local database engine.

C++LSM TreeLevelDBsetup: moderatecomplexity 4/5

RocksDB is an embeddable, persistent key-value storage library developed by Facebook. A key-value store is a database where each piece of data is stored and retrieved using a unique key, much like a dictionary or hash map, but persisted to disk rather than kept only in memory. RocksDB is designed specifically for fast storage hardware like SSDs and NVMe drives, making it well suited for high-throughput applications.

The library is built on the Log-Structured Merge Tree, or LSM tree, design. This approach batches writes in memory and periodically merges them to disk in sorted files, which makes write operations very fast even at high volumes. Reads involve checking multiple levels of data, and the system uses background compaction processes to keep reads efficient by merging and reorganizing the files periodically. This design involves trade-offs between write amplification, read amplification, and space usage, which RocksDB exposes as configurable parameters.

RocksDB is a library, not a standalone database server. You embed it directly into your application by linking against the C++ library and calling its API. Many databases and data-intensive systems use RocksDB as their underlying storage engine, replacing or supplementing their own storage layers.

You would use RocksDB when building a system that needs a fast, reliable, local key-value store embedded directly in your application, such as a database, a caching layer, a message queue, or a metadata store. It is particularly suitable for workloads with heavy writes, multi-terabyte datasets, or requirements for very low write latency on flash storage.

The primary language is C++. RocksDB is dual-licensed under GPLv2 and Apache 2.0. It builds on earlier work from Google's LevelDB project.

Where it fits