← All open source projects

LevelDB

google/leveldb

LevelDB is Google’s fast embedded key-value storage library with ordered keys.

Forks 8,203
Author google
Language C++
License BSD-3-Clause
Synced 2026-06-27

What It Is

LevelDB is a fast key-value storage library written at Google. Its authors are Sanjay Ghemawat and Jeff Dean.

The project provides an ordered mapping from string keys to string values. Keys and values are arbitrary byte arrays, and callers can provide a custom comparison function.

LevelDB is not a database server. It is an embedded library that an application links into its own process to store local data without a separate daemon.

What Is Inside

The basic operations are Put, Get, and Delete. Multiple changes can be grouped into an atomic batch so the application sees one consistent update.

Data is stored sorted by key. That matters for range reads and ordered scans where the application needs neighboring records, not just a single lookup.

The repository explicitly notes that maintenance is currently very limited. The team mainly reviews critical bugs, data-loss risks, memory corruption, and changes required by internally supported clients.

How People Use It

LevelDB is used for local indexes, caches, metadata, queues, and small embedded stores where a SQL database or server process would be too much.

It fits applications that manage their own data lifecycle and want predictable key-based storage.

The limitation is that LevelDB does not provide SQL queries, network access, user roles, or distributed replication. Those layers must be built above it or handled by another tool.

Operation Model

The example is not exact C++ syntax. It shows the working model: write, read, delete, and batch update.

Strengths And Limits

LevelDB’s strength is simple, predictable embedded storage. An application gets a fast ordered key-value layer without a separate service.

The weak point is limited current maintenance. New large products should decide whether that support model fits their requirements.

LevelDB fits infrastructure components, local caches, and systems that need a small reliable storage layer. Multi-user databases with queries, roles, and analytics need a different class of product.

Example

Basic Operations

The neutral example shows the typical actions an application performs on top of LevelDB.

Language: Plain text
db.Put("user:42", "Alice")
value = db.Get("user:42")
db.Delete("user:42")

batch.Put("user:43", "Bob")
batch.Delete("user:41")
db.Write(batch)