talira

RocksDB/LevelDB inspired key-value database in Go

open sourceBSD-3-Clausefree

Pebble is an embedded key-value store for Go, inspired by LevelDB and RocksDB and written for CockroachDB, which has used it as its default storage engine since v20.2 in November 2020. It's a log-structured merge tree that keeps RocksDB's file formats and the features CockroachDB needs (snapshots, checkpoints, indexed batches, range deletions, SSTable ingestion, prefix bloom filters, merge operators), and leaves out others such as column families, transactions, backups and universal compaction. Compared with RocksDB it has faster reverse iteration, a more concurrent commit pipeline and concurrent compactions out of L0, and it's pure Go with no cgo. Cockroach Labs maintains it under the BSD 3-Clause licence.

Problems it solves

  • an embedded key-value store for a Go service that doesn't need cgo like RocksDB does
  • a fast persistent sorted key-value store inside my Go program
  • a storage engine for building my own database in Go

Features

  • embedded LSM key-value store in pure Go, no cgo
  • reads and writes RocksDB's file formats
  • snapshots, checkpoints and indexed batches
  • range deletion tombstones, single delete and merge operators
  • SSTable ingestion and prefix bloom filters
  • CockroachDB's storage engine in production since 2020

Limitations

  • Lacks RocksDB's column families, transactions, backups and universal compaction, and may corrupt data if opened on a RocksDB database using a feature it lacks1

Alternatives

The same job

These do what Pebble does.

  1. RocksDB Embeddable persistent key-value store for fast storage
  2. Badger Embeddable, persistent key-value database in pure Go
  3. bbolt An embedded key/value database for Go
  4. LMDB Lightning Memory-Mapped Database: a tiny, crash-proof embedded key-value store

Compare Pebble with the top 3