Sled is an embedded key-value database written in Rust that provides a BTreeMap-like API for persistent storage.
Sled addresses the need for an embedded database that avoids expensive deserialization costs and provides strong consistency guarantees. It uses a log-structured storage format optimized for flash media and implements lock-free, cpu-scalable concurrent access. The tool stores data as byte slices and offers zero-copy reads, allowing applications to work with structured data efficiently. It supports serializable ACID transactions across multiple keys and keyspaces, atomic single-key operations including compare-and-swap, and merge operators for custom value combination logic.
Developers should choose Sled for applications requiring an embedded database with strong transactional semantics and high concurrency without external dependencies. It suits projects that need to avoid deserialization overhead and benefit from its crash-safe monotonic ID generator, which can produce 75-125 million unique IDs per second. The tool includes optional zstd compression and implements modern b-tree optimizations like prefix encoding and suffix truncation that can reduce key storage by over 99% for sequential keys of uniform length. Sled provides range iteration in both directions, key prefix subscriptions for change notifications, and write batches for bulk operations.
The project maintains a Discord community for database discussions. The README notes that it contains a large in-progress rewrite on the main branch and is currently out of sync with the documentation, indicating substantial architectural changes underway. The codebase emphasizes formal methods and fuzzing for correctness validation, reflecting a focus on reliability in a database system.