BT

InfoQ Homepage News Google Has Open Sourced LevelDB, A Key-Value Datastore

Google Has Open Sourced LevelDB, A Key-Value Datastore

Bookmarks

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
Style

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.

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

Community comments

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

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

BT

Is your profile up-to-date? Please take a moment to review and update.

Note: If updating/changing your email, a validation request will be sent

Company name:
Company role:
Company size:
Country/Zone:
State/Province/Region:
You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.