Skip to main content
Here is an ever-growing list of frequently asked questions around RocksDB.

General Questions

RocksDB is an embeddable persistent key-value store for fast storage. It can also be the foundation for a client-server database, but our current focus is on embedded workloads.RocksDB builds on LevelDB to be scalable to run on servers with many CPU cores, to efficiently use fast storage, to support IO-bound, in-memory and write-once workloads, and to be flexible to allow for innovation.
For the latest details, watch Mark Callaghan’s and Igor Canadi’s talk at CMU or Dhruba Borthakur’s introductory talk from the Data @ Scale 2013 conference.
We benchmarked LevelDB and found that it was unsuitable for our server workloads. The benchmark results looked impressive at first sight, but we quickly realized that those results were for a database whose size was smaller than the size of RAM on the test machine — where the entire database could fit in the OS page cache. When we performed the same benchmarks on a database that was at least 5 times larger than main memory, the performance results were poor.By contrast, we’ve published RocksDB benchmark results for server-side workloads on Flash. We also measured the performance of LevelDB on these server-workload benchmarks and found that RocksDB solidly outperforms LevelDB for IO-bound workloads.Key findings:
  • LevelDB’s single-threaded compaction was insufficient for server workloads
  • Frequent write-stalls with LevelDB caused poor 99-percentile latency
  • Memory-mapping files introduced performance bottlenecks for reads
  • LevelDB couldn’t fully utilize the IOPS offered by modern Flash storage
RocksDB can be used by applications that need low latency database accesses. Ideal use cases include:
  • User-facing applications that store viewing history and state of users
  • Spam detection applications that need fast access to big data sets
  • Graph-search queries that need to scan a data set in realtime
  • Caching Hadoop data, allowing applications to query Hadoop data in realtime
  • Message queues that support a high number of inserts and deletes
RocksDB is an embedded storage engine used in numerous backend systems at Facebook and beyond:At Facebook:
  • Replaced Centrifuge in the Facebook newsfeed backend
  • Powers ZippyDB, a distributed key-value store used across Facebook products
  • Used in Dragon, a distributed graph query engine
  • Parse ran MongoDB on RocksDB in production since early 2015
Industry Adoption: RocksDB has proven to be a useful component for many other groups in the industry. Check out our Users page for a comprehensive list of projects currently using RocksDB.
Learn more about ZippyDB in Muthu Annamalai’s talk at Data@Scale.

Database Storage Engine

Our engineering team at Facebook firmly believes that RocksDB has great potential as a storage engine for databases. It has been proven in production with multiple database systems:MongoRocks: The RocksDB-based storage engine for MongoDB, proven in production environments.MyRocks: The RocksDB-based storage engine for MySQL. Using RocksDB, we achieved:
  • 2x better compression compared to existing MySQL setup
  • 10x less write amplification for our benchmarks
MyRocks has been developed into a production-ready solution for web-scale MySQL workloads. Follow development on GitHub!

Learn More About MyRocks

Read the technical deep-dive on MyRocks performance improvements
We are open sourcing this project on GitHub because we believe it will be useful beyond Facebook.Our goals:
  • Enable software programmers and database developers to use, enhance, and customize RocksDB for their use cases
  • Engage with the academic community on topics related to efficiency for modern database algorithms
  • Foster innovation in the embedded database space
  • Build a community around high-performance storage engines
RocksDB is open source under a dual license: Apache License 2.0 and GPLv2.

Performance and Optimization

RocksDB offers extensive tuning options. Start with these key areas:
  • Block cache size: Tune based on your working set size
  • Write buffer size: Adjust memtable size for write performance
  • Compaction style: Choose between level, universal, or FIFO compaction
  • Compression: Select appropriate compression algorithms for each level
  • Bloom filters: Enable to reduce read amplification

Tuning Guide

Read our comprehensive tuning guide for detailed recommendations
Important metrics to track:
  • Write amplification: Amount of data written to storage vs. data written by application
  • Read amplification: Number of disk reads per query
  • Space amplification: Database size on disk vs. actual data size
  • Compaction throughput: Bytes processed per second during compaction
  • Stall time: Time spent waiting for compaction to catch up
Use RocksDB’s built-in statistics and the db_bench tool to measure these metrics.

Architecture and Design

RocksDB is built on top of LevelDB’s core architecture but extends it significantly:Inherited from LevelDB:
  • LSM-tree (Log-Structured Merge-tree) architecture
  • SSTable file format (with enhancements)
  • Basic compaction concepts
RocksDB enhancements:
  • Multi-threaded compaction
  • Column families
  • Transactions and optimistic concurrency control
  • Backup and checkpoint support
  • Multiple compaction styles
  • Enhanced block cache
  • Much more configurability
RocksDB is designed for high concurrency:
  • Thread-safe reads and writes: Multiple threads can read and write simultaneously
  • Lock-free reads: Reads don’t block writes or other reads (with MVCC)
  • Multi-threaded compaction: Compaction runs in background threads without blocking
  • Write batching: Multiple writes can be batched for better throughput
Iterators create snapshots and hold references to data, which can prevent obsolete data from being deleted. Close iterators when done to free resources.

Getting Help

GitHub Discussions

Ask questions and discuss RocksDB with the community

Report Issues

Found a bug? Report it on GitHub

Contributing

Learn how to contribute to RocksDB

Users List

See who else is using RocksDB

Build docs developers (and LLMs) love