| LevelDB | |
|---|---|
| Developers | Jeffrey Dean,Sanjay Ghemawat,Google Inc. |
| Stable release | |
| Repository | |
| Written in | C++ |
| Size | 350 kB (binary size) |
| Type | Database library |
| License | New BSD License |
| Website | github |
LevelDB is anopen-sourceon-disk key-value store written byGoogle fellowsJeffrey Dean andSanjay Ghemawat.[2][3] Inspired byBigtable,[4] LevelDB source code is hosted onGitHub under theNew BSD License and has been ported to a variety ofUnix-based systems,macOS,Windows, andAndroid.[5]
LevelDB stores keys and values in arbitrary byte arrays, and data is sorted by key. It supports batching writes, forward and backward iteration, and compression of the data via Google'sSnappy compression library.
LevelDB is not anSQL database. Like otherNoSQL anddbm stores, it does not have arelational data model and it does not support SQL queries. Also, it has no support forindexes. Applications use LevelDB as a library, as it does not provide a server or command-line interface.
MariaDB 10.0 comes with a storage engine which allows users to query LevelDB tables from MariaDB.[6]
LevelDB is based on concepts from Google'sBigtable database system. The table implementation for the Bigtable system was developed starting in about 2004, and is based on a different Google internal code base than the LevelDB code. That code base relies on a number of Google code libraries that are not themselves open sourced, so directly open sourcing that code would have been difficult. Jeff Dean and Sanjay Ghemawat wanted to create a system resembling the Bigtable tablet stack that had minimal dependencies and would be suitable for open sourcing, and also would be suitable for use in Chrome for theIndexedDB implementation. They wrote LevelDB starting in early 2011, with the same general design as the Bigtable tablet stack, but not sharing any of the code.[7]
LevelDB is used as the backend database forGoogle Chrome'sIndexedDB and is one of the supported backends forRiak.[8] Additionally,Bitcoin Core and go-ethereum store theblockchain metadata using a LevelDB database.[9]Minecraft Bedrock Edition uses a modified version for chunk and entity data storage.[10] Autodesk AutoCAD 2016 also uses LevelDB.
Google has provided benchmarks comparing LevelDB's performance toSQLite andKyoto Cabinet in different scenarios.[11] LevelDB outperforms both SQLite and Kyoto Cabinet in write operations and sequential-order read operations. LevelDB also excels at batch writes, but is slower than SQLite when dealing with large values. The currently published benchmarks were updated after SQLite configuration mistakes were noted in an earlier version of the results.[12] Updated benchmarks[13] show that LevelDB also outperformsBerkeley DB, but these tests also show thatOpenLDAPLightningDB is much faster (~10 times in some scenarios) in read operations and some write types (e.g. batch and synchronous writes, see the link above), and is almost equal in the rest of the test.
All the above benchmarks date back from 2011 to 2014, and may only be of historical significance as SQLite, for instance, became significantly more efficient.[14]
LevelDB has a history of database corruption bugs.[15][16][17][18][19][20] A study from 2014 has found that, on non-checksummed file systems, the database could become corrupted after a crash or power failure.[21]