RocksDB: an embeddable LSM key-value library for flash storage
A library that provides an embeddable, persistent key-value store for fast storage.
At a glance
- What is it?
- RocksDB is a C++ library, not a server, and the public interface lives in include/. This article covers what it is good for, how compaction and the LSM design shape its behaviour, how to build it, and who should pick something else.
- Who is it for?
- Adopt RocksDB when you need an embedded persistent store in a C++ or C application, or when another system already uses it as its storage engine and you want to understand the layer underneath. Do not adopt it if you want a network service with a query language, or if the GPLv2 option in the dual licence is a problem for your distribution model.
- Can I use it commercially?
- Yes, with conditions. GPL-2.0 is a copyleft licence: if you distribute software that includes it, you must release that software's source code under the same licence. Running it internally without distributing it does not trigger that obligation.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly C++, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 29, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
What RocksDB is, and the problem it removes
RocksDB is a library that forms the core building block for a fast key-value server, in the README's words, especially suited for storing data on flash drives. That sentence carries the whole positioning. It is not a database server you connect to over a socket. You link it into your process and it manages files on disk for you.
The problem it removes is the gap between an in-memory data structure and durable storage. If you keep a hash map in RAM and want it to survive a restart, you have to write your own write-ahead log, your own recovery path, your own file format, and your own background process for reclaiming space. RocksDB gives you a put, get and delete API over an ordered key space, and it handles the durability and space reclamation behind that API.
It is built on earlier work on LevelDB by Sanjay Ghemawat and Jeff Dean, and the README says so directly. The Facebook Database Engineering Team develops and maintains it. The audience is therefore not application developers looking for a database to query. It is the people building the storage layer of something else: a message broker, a stream processor, a cache, or a service that needs a local persistent index. The repository's USERS.md file exists for exactly that reason.
The LSM design and what the amplification factors cost you
RocksDB has a Log-Structured-Merge-Database design, and the README frames it as offering flexible tradeoffs between Write-Amplification-Factor, Read-Amplification-Factor and Space-Amplification-Factor. Those three acronyms are the useful mental model. Every configuration choice you make moves cost between them.
Writes land in a memtable in memory and are flushed to sorted files on disk. Reads have to check the memtable and then potentially several levels of those files, which is read amplification. Background compactions merge files between levels, which rewrites data and is write amplification. Until compaction catches up, obsolete versions of keys occupy space, which is space amplification. You cannot drive all three to zero. A workload that writes constantly and reads rarely wants a different balance from one that reads constantly and writes little.
The README notes multi-threaded compactions and says the design is especially suitable for storing multiple terabytes of data in a single database. That is a real strength, but it is also where the operational weight sits. Compaction is background work that consumes disk bandwidth and CPU. If your write rate outpaces compaction, the space amplification grows and reads slow down. This is the failure mode people hit in production, and it is a property of the design rather than a bug.
Building RocksDB from source and writing a first key
The public interface is in include/, and the README warns that callers should not include or rely on the details of any other header files, because internal APIs may change without warning. Treat that as a hard boundary in your build.
The repository ships a Makefile and a CMakeLists.txt, and INSTALL.md is the file to read for platform-specific steps. The Makefile comments describe three debug levels: DEBUG_LEVEL=2 compiles without optimizations via make dbg, DEBUG_LEVEL=1 is the default for make all, and DEBUG_LEVEL=0 is the release level, reached with make shared_lib or make install-shared. For anything you intend to run in production, the comment is explicit that you want level 0.
make shared_lib
make install-sharedThe README points to the examples directory as the place to start, and the repository lists simple_example.cc, column_families_example.cc, transaction_example.cc and others there. The examples directory has its own Makefile and CMakeLists.txt, so you can build them against your installed library rather than reasoning about the API from the wiki.
cd examples
makeIf you would rather drive RocksDB from another language, LANGUAGE-BINDINGS.md lists what the project knows about, and the repository contains a java/ directory and a c_api_gen/ directory for the C API. The README does not document a Python binding in the core repository, so treat any Python package you find as a separate project with its own release cycle.
Where RocksDB is the wrong tool
The README does not document a network protocol, a query language, or a user and permission model. If you need any of those, RocksDB is the wrong layer, and no amount of configuration will add them. You would be writing a server around it, which is a different project.
The second limitation is the licence. The README states RocksDB is dual-licensed under GPLv2, found in COPYING, and Apache 2.0, found in LICENSE.Apache, and that you may select one of the two at your option. That is a genuine choice, but it is a choice you have to make deliberately. The repository also carries LICENSE.leveldb for the inherited LevelDB code. This is not legal advice, and the practical reading depends on how you distribute your binary, so the licence files themselves are the source to check.
The third limitation is operational. Because RocksDB runs inside your process, its resource use is your process's resource use. Compaction threads compete with your request-handling threads for CPU and disk. There is no separate service to scale out, no connection pool to tune, and no dashboard that comes with it. The monitoring/ directory exists, but you are the one who wires it up.
Finally, the ordered key space is a constraint. If your data is naturally relational, with joins and ad hoc queries, you are building an index by hand on top of a key-value store. That is sometimes the right call and often is not.
RocksDB against LevelDB, SQLite and Redis
LevelDB is the direct ancestor, and the README says so. The difference in approach is that RocksDB kept the LSM idea and added the machinery for larger and more concurrent workloads: multi-threaded compactions, column families, transactions, and the amplification tradeoffs you can tune. LevelDB's scope is narrower. If your dataset is small and single-threaded, the extra surface in RocksDB buys you nothing.
SQLite is the closest comparison in spirit, since both are embeddable libraries rather than servers. The difference is the storage model. SQLite is a relational engine with SQL, transactions and a B-tree layout, and it is built around reading and writing a single file. RocksDB is a key-value store with an LSM layout, built around sustained write throughput and datasets that exceed RAM. If you need SQL, RocksDB is not a substitute. If you need to absorb a high write rate into an ordered store, SQLite's B-tree has a different cost profile.
Redis is the comparison people search for most often, and the difference is durability and model rather than speed. Redis is a server with a rich set of data types, and persistence is a feature layered on top. RocksDB is a library whose primary job is persistence, with a plain key-value interface. You can build a Redis-like service on RocksDB, and the repository's own USERS.md is the place to see who has.
Maintenance, releases and upgrade cost
The repository is not archived, and the last push was on 2026-09-10, so the project is under current development. The release history shows v11.8.1 on 2026-08-07, v11.1.2 on 2026-06-25 and v11.1.1 on 2026-04-29. That cadence is worth noting when you plan: if you track releases closely, you will be rebuilding against a moving library.
Upgrade cost is not just recompiling. On-disk formats and options evolve, and the repository carries DEFAULT_OPTIONS_HISTORY.md and DUMP_FORMAT.md, which exist because those things change over time. HISTORY.md is the file to read before moving a production deployment between versions. The README's warning about internal headers is the other half of the upgrade story: if you reach past include/, a version bump can break your build without warning, and that is by design.
Because RocksDB is embedded, an upgrade means shipping a new binary of your own application. There is no server to restart independently and no rolling upgrade you can do separately from your own release process. That coupling is the real maintenance cost, and it is larger than the library's own release notes suggest.
Editorial conclusion
Adopt RocksDB when you need an embedded persistent store in a C++ or C application, or when another system already uses it as its storage engine and you want to understand the layer underneath. Do not adopt it if you want a network service with a query language, or if the GPLv2 option in the dual licence is a problem for your distribution model. Before committing, verify two things against your own workload: how compaction behaves when your write rate is high and your disk is slow, and whether your access pattern actually fits a key-value API rather than a relational one. Start from examples/simple_example.cc and the options file example in examples/, not from the wiki alone.
Frequently asked questions
What is RocksDB used for?
It is a library that forms the core building block for a fast key-value server, especially suited for storing data on flash drives. The README describes it as having multi-threaded compactions and being suitable for storing multiple terabytes of data in a single database.
What are the disadvantages of RocksDB?
It is an embedded library with no network protocol, query language or permission model, so anything server-shaped has to be built around it. Its LSM design also forces a tradeoff between write, read and space amplification, and background compaction competes with your own threads for CPU and disk.
How do I install RocksDB on Ubuntu?
The repository gives a Makefile and a CMakeLists.txt, and INSTALL.md holds the platform-specific steps. For a production build the Makefile comments point at DEBUG_LEVEL=0, reached with make shared_lib followed by make install-shared.
How do I use RocksDB in Python?
The README does not document a Python binding in the core repository. LANGUAGE-BINDINGS.md lists the bindings the project knows about, and the repository itself contains a java/ directory and a c_api_gen/ directory for the C API.
What is RocksDB written in?
It is a C++ library, and the public interface is in include/. The README warns that callers should not include or rely on any other header files, since those internal APIs may change without warning.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/facebook-rocksdb)
Community notes