In-Memory Databases
Durability strategies
| Approach | Example | Use case | Trade-off |
|---|---|---|---|
| No durability | Memcached | Caching only | Data lost on restart — and that's acceptable |
| Disk logging | VoltDB, RAMCloud | Persistent storage | Append-only log for recovery |
| Periodic snapshots | Redis (basic) | Persistent storage | Periodic state snapshots to disk |
| Replication | Couchbase | Persistent storage | In-memory state replicated to other machines |
| Hardware | Oracle TimesTen | Persistent storage | Battery-backed RAM — expensive |
The product landscape
Relational
VoltDB (SQL-based, writes to disk periodically), SingleStore, Oracle TimesTen.
Key-value
Durable: RAMCloud (log-structured). Weak durability: Redis, Couchbase (async disk writes).
Secondary advantages
- Operational benefits of disk writes even when disk isn't the primary store: easy backups, external inspection and analysis tooling, audit trails.
- Simplified implementations. Complex data structures — priority queues, sorted sets — are far easier to implement when everything is in memory. Redis's simple-but-powerful API is a direct consequence.
The organizing principle: disk is used as an append-only log for durability, not as primary storage. All reads are served from memory. Replication and snapshots enable recovery without special hardware.
The Invariants
- Guarantees: Read latency bounded by RAM access and by never paying serialization cost, plus data structures that would be impractical on a page-oriented layout.
- Does not guarantee: Durability — that is a per-product configuration choice ranging from "none" (Memcached) to battery-backed RAM, and the default is usually weaker than people assume.