sled
Sled is an embedded key-value database written in Rust designed for high-concurrency, long-running services. It combines log-structured storage with B+ tree semantics, offering atomic operations, transactions, and automatic crash recovery without requiring a separate server process.
Key facts
Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.
| Field | Value |
|---|---|
| Repository | spacejam/sled |
| Owner | spacejam |
| Primary language | Rust |
| License | Apache-2.0 — OSI-approved |
| Stars | 9k |
| Forks | 427 |
| Open issues | 171 |
| Latest release | v0.34.7 (2021-09-12) |
| Last updated | 2026-04-04 |
| Source | https://github.com/spacejam/sled |
What sled is
Lock-free concurrent B+ tree with log-structured merge semantics, providing ACID transactions, zero-copy reads, compare-and-swap operations, and configurable fsync durability (default 500ms). Implements prefix encoding, suffix truncation, and scatter-gather page reconstruction for flash-optimized storage.
Get the sled source
Clone the repository and explore it locally.
git clone https://github.com/spacejam/sled.gitcd sled# follow the project's README for install & configurationNeed it deployed, integrated, or customized instead? DEV.co ships production installs.
Best use cases
Implementation considerations
- API mirrors std::BTreeMap<[u8], [u8]>; all keys and values are byte slices. Use IVec (inlinable Arc slice) for in-memory representation; no built-in serialization—users must handle serde or bincode themselves.
- Transactions are optimistic and non-blocking; do not perform external IO or side effects inside transaction closures unless idempotent, or accept retry semantics.
- Numerical keys must be stored big-endian (e.g. u64::to_be_bytes()) to align lexicographic byte ordering with numeric ordering; little-endian will silently break range queries above 256 items.
- Default fsync interval is 500ms; configure flush_every_ms or call flush()/flush_async() manually if stronger durability SLAs are required.
- Single open instance per process. Use lazy_static or once_cell for global safe access; operations are thread-safe but multiple Db::open() calls to the same path are not supported.
When to avoid it — and what to weigh
- Absolute reliability is non-negotiable — README explicitly states 'if reliability is your primary constraint, use SQLite.' Sled is still in beta; durability is automatic but 500ms default fsync interval may not meet strict ACID guarantees for all use cases.
- Storage cost or space efficiency is critical — README notes 'if storage price performance is your primary constraint, use RocksDB. sled uses too much space sometimes.' Space overheads are not fully quantified.
- Multi-process concurrent access required — Sled does not support multiple open instances to the same database. Architected for single long-running process; multi-process workloads must implement external serialization.
- You need predictable, sub-millisecond latency — Automatic background fsyncs and log-structured compaction can introduce unpredictable latency spikes. No real-time guarantees documented.
License & commercial use
Apache License 2.0 (Apache-2.0). Permissive OSI-approved open-source license allowing commercial use, modification, and distribution with liability disclaimer and license notice requirements.
Apache-2.0 is a permissive license suitable for commercial use. However, the README warns that sled is in beta and the on-disk format will change before 1.0.0, requiring manual migrations. Evaluate stability and support maturity for production workloads; no SLA or commercial support vendor mentioned.
DEV.co evaluation signals
Editorial assessment — not user reviews. Directional, with an explicit confidence level.
| Signal | Assessment |
|---|---|
| Maintenance | Active |
| Documentation | Adequate |
| License clarity | Clear |
| Deployment complexity | Low |
| DEV.co fit | Good |
| Assessment confidence | High |
No explicit security audit or formal verification mentioned in provided data. Lock-free implementation reduces deadlock risk but increases complexity surface. No mention of encryption at rest, TLS transport, or access control. Fuzzing and formal-methods mentioned as topics but no detailed results provided. Evaluate threat model and consider sled's beta status when assessing security posture for sensitive data.
Alternatives to consider
SQLite
Mature, single-file, ACID-compliant embedded database with broader language support. Preferred if reliability is the primary constraint (per sled's own README guidance).
RocksDB
Production-proven LSM tree KV store with better space efficiency and optional multi-process support via shared libraries. Preferred if storage cost/performance ratio is critical.
LMDB
Lightweight, multi-process-safe memory-mapped B+ tree with minimal write overhead. Preferred for multi-process read-heavy workloads; lower concurrency than sled.
Build on sled with DEV.co software developers
Sled is powerful for stateful Rust services but carries beta-stage risks and design constraints (single-process, durability tuning, format migration). Let's help you assess fit against your reliability, performance, and operational requirements.
Talk to DEV.coRelated open-source tools
Surfaced by semantic similarity across the DEV.co open-source index.
Related on DEV.co
Explore the category and the services that help you build with it.
sled FAQ
Is sled production-ready?
Does sled support multiple processes accessing the same database?
How does durability work?
What's the performance profile?
Software development & web development with DEV.co
From first prototype to production, DEV.co delivers software development services around tools like sled. Our software development agency staffs experienced software developers and web developers for custom software development, web development, integrations, and ongoing support across open-source databases and beyond.
Evaluating Sled for your embedded database layer?
Sled is powerful for stateful Rust services but carries beta-stage risks and design constraints (single-process, durability tuning, format migration). Let's help you assess fit against your reliability, performance, and operational requirements.