LevelDB is an open-source on-disk key-value store written by Google fellows Jeffrey Dean and Sanjay Ghemawat and it is inspired by Bigtable. It is based on a log-structured merge-tree (LSM tree) data structure.
RocksDB is developed and maintained by Facebook Database Engineering Team. It is built on earlier work on LevelDB.
This code is a library that forms the core building block for a fast key-value server, especially suited for storing data on flash drives. It has a Log-Structured-Merge-Database (LSM) design with flexible tradeoffs between Write-Amplification-Factor (WAF), Read-Amplification-Factor (RAF) and Space-Amplification-Factor (SAF).
It has multi-threaded compactions, making it especially suitable for storing multiple terabytes of data in a single database.
Features of LevelDB :
- Keys and values are arbitrary byte arrays.
- Data is stored sorted by key.
- Callers can provide a custom comparison function to override the sort order.
- The basic operations are
- Multiple changes can be made in one atomic batch.
- Users can create a transient snapshot to get a consistent view of data.
- Forward and backward iteration is supported over the data.
- Data is automatically compressed using the Snappy compression library.
- External activity (file system operations etc.) is relayed through a virtual interface so users can customize the operating system interactions.
Features of RocksDB:
RocksDB provides all of the features of LevelDB, plus:
- Backups and snapshots
- Column families
- Bloom filters
- Time to live (TTL) support
- Universal compaction
- Merge operators
- Statistics collection
- Geospatial indexing
Comparison of LevelDB and RocksDB:
|Developed by Google||Developed by Facebook|
|Open Source||Open Source|
|Key-Value Store||Key-Value Store|
|Built in C++||Built in C++|
|No Transactions||Transactions are supported.|
|Concurrency supported||Concurrency supported.|
|NodeJs,Python,Java C++,Go Api available to access the LevelDB||C++ and Java Api available.|
Here are the results of a run on 100 million values spread out over 500k columns:
Overall it looks like RocksDB might be the best choice compare to LevelDB.
That’s all I have and thanks a lot for reading. Please let me know if any corrections/suggestions. Please do share and comments if you like the post. Thanks in advance… 😉