Google Has Open Sourced LevelDB, A Key-Value Datastore

| by Abel Avram Follow 5 Followers on Jul 29, 2011. Estimated reading time: 1 minute |

A note to our readers: You asked so we have developed a set of features that allow you to reduce the noise: you can get email and web notifications for topics you are interested in. Learn more about our new features.

Google has open sourced LevelDB under the New BSD license. LevelDB is an embedded key-value datastore whose keys and associated values are arbitrary byte arrays sorted by key, a sorting mechanism that can be overridden. The datastore is pretty simple, accepting Put, Get, and Delete commands along with forward and backward iterations.

Data is automatically compressed using Snappy, a compression library used by Google for BigTable, MapReduce, and RPC and open sourced in April. LevelDB has some limitations: no support for SQL queries or indexes, supports multi-threaded single process access and is embedded, which is an advantage for some projects and a problem for others.

LevelDB is optimized for batch write operations. Multiple changes are accumulated and sorted in memory then written to disk when a certain configurable file size threshold is reached. The result is good performance for sequential and random writes, and sequential reads, beating SQLite by two orders of magnitude in some tests, according to a Google performance benchmark. SQLite remains a bit faster than LevelDB for random reads and at least twice as fast in writing large values. LevelDB also performed better than Kyoto Cabinet, a similar key-value store, but not as well as compared to SQLite. Also, some tests were performed by Riak comparing LevelDB with InnoDB, Google’s DB outperforming InnoDB in some tests or had similar performance.

LevelDB has been written in C++, and has few external dependencies being ported successfully to Windows, Mac OS X, Android, and various UNIXs. LevelDB is used by experimental versions of Chrome as the implementation for IndexDB API, by Riak for storage at node level, and by UpNext, a company doing 3D mapping software.

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Check out RaptorDB by M. Gholam

It's a KV store which operates at 80% hard disk speed built on .net

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.

Recover your password...


Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.


More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.


Stay up-to-date

Set up your notifications and don't miss out on content that matters to you