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.[03]
- Source Code
- https://github.com/petermattis/pebble[01]
- Developer
- Country of Origin
- US
- Start Year
- 2018 [07]
- Project Type
- Open Source
- Written in
- Go
- Supported Languages
- Go
- License
- BSD License
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.[03]
Data Model[05]
Pebble uses two types of keys - user keys suited for the user API and 'Internal Keys' which are composed of the user key, a sequence number, and a value signifying the key type. The Internal Key type is used, since the LSM tree requires versioning with keys.
Indexes[06]
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).
Logging[04]
Pebble uses a write-ahead logging (WAL) infrastructure. Batches are first written to the WAL, and then inserted into a memtable. Pebble purposefully maps each WAL file to a memtable.
Storage Architecture[06]
Pebble primarily uses sstables on disk which store various things such as internal keys/values and range tombstone deletions. It also has memtables, which temporarily store committed records before they are written to a sstable.
Citations
7 sources- https://github.com/petermattis/pebble github.com
- https://github.com/petermattis/pebble/tree/master/docs github.com
- GitHub - cockroachdb/pebble: RocksDB/LevelDB inspired key-value database in Go · GitHub github.com
- pebble/docs/rocksdb.md at master · cockroachdb/pebble · GitHub github.com
- pebble/docs/rocksdb.md at master · cockroachdb/pebble · GitHub github.com
- pebble/docs/rocksdb.md at master · cockroachdb/pebble · GitHub github.com
- Initial fork (leveldb -> pebble) github.com