Pebble is a key-value store written in Go and developed by Cockroach Labs. It is based on an unfinished Go port of LevelDB. Furthermore, additional features and optimizations are inspired by parts of RocksDB. Pebble is specifically created to suit the needs of CockroachDB - some features from RocksDB are modified, while others are completely left out. A few examples of modified features include using offsets instead of pointers in the skiplist, and changing the rate of flushes to match user writes.
The project started in 2018 as a replacement for RocksDB running inside of CockroachDB.
Deterministic Concurrency Control
Pebble achieves concurrency during its commit pipeline, by using a 'commit queue'. In order to commit a batch, Pebble must first write the batch to its WAL and then add it to a memtable. The commit queue allows Pebble to synchronize writes to the WAL first. Then batches can be concurrently added to their memtables.
Pebble uses a LSM tree to store writes. All records are stored in batches, which in turn are stored in in-memory memtables and sstables. To support indexing, there is a separate skiplist implementation based on RocksDB. It stores offsets to the records within their batch in order to perform reads. Furthermore, batches themselves are transformed into levels of the LSM tree (with temp sequence numbers set to be the most recent sequence).
https://github.com/petermattis/pebble
https://github.com/petermattis/pebble
https://github.com/petermattis/pebble/tree/master/docs
Cockroach Labs
2018