What it is
A write back cache, also called write behind, accepts a write into the cache and acknowledges it immediately. The database is updated asynchronously a short time later, often after batching several writes together.
Why it is fast
- The slow database write is removed from the critical path.
- Repeated writes to the same key can be coalesced into one database update.
- Bursts of writes are smoothed into steady background flushes.
The big risk
If the cache node crashes before a dirty entry is flushed, that write is lost forever. Mitigations include replication, durable write logs, and short flush intervals, but the data still lives briefly only in the cache.
When to use it
Write back suits high write throughput where occasional loss is tolerable, such as metrics, counters, or analytics buffers. It is a poor fit for money or orders that demand durability.
Key idea
Write back trades durability for throughput by buffering writes in the cache and flushing them to the database in the background.