Add fast persistent key-value storage inside a Go application without running a separate database server process.
Store and retrieve terabytes of data on SSDs with high read and write throughput using concurrent ACID transactions.
Build a self-expiring cache or session store in Go using BadgerDB's built-in time-to-live key expiry feature.
BadgerDB is an embeddable, persistent key-value database written in pure Go. A key-value store maps unique names to chunks of data, like a dictionary that survives restarts. Because it is embeddable, you do not run it as a separate server, you import it as a library directly into your Go program and it stores data on the local disk. Badger is the underlying storage engine for Dgraph, a distributed graph database, and was created as a faster Go-native alternative to non-Go stores like RocksDB. Internally, Badger uses an LSM tree with a value log, based on the WiscKey research paper that separates keys from values to reduce write amplification on solid-state drives. Because of this design, Badger is specifically tuned for SSDs and aims for high throughput on both reads and writes, even on data sets in the terabytes range. It supports concurrent ACID transactions with serializable snapshot isolation, meaning many parts of your program can read and write at the same time without corrupting each other's view of the data. Other features include snapshots, time-to-live expiry on keys, and access to multiple versions of the same key. A nightly Jepsen-style bank test, run for hours with race detection on, exercises these transactional guarantees. You would reach for Badger when you need fast embedded storage inside a Go application and do not want the overhead of running a separate database process. Existing users include Dgraph, the Jaeger tracing platform, go-ipfs, and several distributed search and messaging projects. Installation is through go get, and a command-line tool is included for offline backup and restore. The full README is longer than what was provided.
← dgraph-io on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.