RocksDB
Embedded key-value database

RocksDB is a high performance embedded database for key-value data. It is a fork of Google's LevelDB optimized to exploit multi-core processors (CPUs), and make efficient use of fast storage, such as solid-state drives (SSD), for input/output (I/O) bound workloads. It is based on a log-structured merge-tree (LSM tree) data structure. It is written in C++ and provides official language bindings for C++, C, and Java. Many third-party language bindings exist. RocksDB is free and open-source software, released originally under a BSD 3-clause license. However, in July 2017 the project was migrated to a dual license of both Apache 2.0 and GPLv2 license. This change helped its adoption in Apache Software Foundation's projects after blacklist of the previous BSD+Patents license clause.
RocksDB is used in production systems at various web-scale enterprises including Facebook, Yahoo!, and LinkedIn.
01Features
RocksDB, like LevelDB, stores keys and values in arbitrary byte arrays, and data is sorted byte-wise by key or by providing a custom comparator.
RocksDB provides all of the features of LevelDB, plus:
- Transactions
- Backups and snapshots
- Column families
- Bloom filters
- Time to live (TTL) support
- Universal compaction
- Merge operators
- Statistics collection
- Geospatial indexing
and others.
RocksDB is not an SQL database (although MyRocks combines RocksDB with MySQL). Like other NoSQL and dbm stores, it has no relational data model, and it does not support SQL queries. Also, it has no direct support for secondary indexes, however a user may build their own internally using Column Families or externally. Applications use RocksDB as a library, as it provides no server or command-line interface.
02History
03Integration
As an embeddable database, RocksDB can be used as a storage engine within a larger database management system (DBMS). For example, Rockset uses RocksDB mostly for analytical data processing.
Alternative backend
The following projects have been started to replace or offer alternative storage engines for already-established database systems with RocksDB:
ArangoDB
ArangoDB has added RocksDB to its previous storage engine ("mmfiles"). RocksDB is be the default storage engine since ArangoDB 3.4.
Cassandra
The Instagram team at Facebook developed and open-sourced their code, along with benchmarks of their performance results.
MariaDB
MariaDB can use the MyRocks storage engine (which is forked from RocksDB) since MariaDB 10.2.5 (Alpha status). and stable since MariaDB 10.2.16 in 2018.
MongoDB
The MongoRocks project provides a storage module for MongoDB where the storage engine is RocksDB.
A related program is Rocks Strata, a tool written in Go, which allows managing incremental backups of MongoDB when RocksDB is used as the storage engine.
MySQL
The MyRocks project created a new RocksDB-based storage engine for MySQL. In-depth details about MyRocks were presented at Percona Live 2016.
Oxigraph
Oxigraph is a graph database implementing the SPARQL standard, based on RocksDB
UKV
The UKV project allows users to use RocksDB on par with LevelDB as the underlying key-value store. It represents a shared abstraction for create, read, update and delete (CRUD) operations common to every storage engine. It augments it with structured bindings for several high-level languages, including Python, Java, and Go.
Embedded
The following database systems and applications have chosen to use RocksDB as their embedded storage engine:
Ceph's BlueStore
The Ceph's BlueStore storage layer uses RocksDB for metadata management in OSD devices.
Apache Flink
Apache Flink uses RocksDB to store operator state and to perform lightweight incremental checkpoints.
FusionDB
FusionDB uses RocksDB as its storage engine for XML, Key/Value, and JSON.
LogDevice LogsDB
LogDevice's LogsDB is built atop RocksDB.
Kafka Streams
Kafka Streams uses RocksDB for its state stores.
Manhattan
The Manhattan Distributed Key-Value Store has used RocksDB as its primary engine to store Twitter data since 2018.
Rockset
The Rockset service that is used for operational data analytics uses RocksDB as its storage engine.
SSDB
The ssdb-rocks project uses RocksDB as the storage engine for the SSDB NoSQL Database.
TiDB
The TiDB project uses RocksDB as its storage engine.
YugabyteDB
The YugabyteDB database uses a modified version of RocksDB as part of its DocDB storage engine.
04Third-party language bindings
05Notable users
- Meta Platforms: Used in osquery.
- Cloudflare: In Quicksilver, a configuration store.
Sources and credits
This article is adapted from the Wikipedia article “RocksDB”, written by its contributors and licensed under CC BY-SA 4.0. Fathomly has changed the layout, removed citation markers, navigation and maintenance notices, and adjusted punctuation. This adapted version is shared under the same license. For references, see the original article.
Images, from Wikimedia Commons:
- Rocksdb-icon.svg by Facebook, CC BY 4.0
Fathomly is not affiliated with or endorsed by the Wikimedia Foundation. Spotted a problem? Tell us.