Eventual consistency is allowed here, but I wanted writes visible immediately on the read path, so the cache sits in the write path, not beside it.
A PUT goes app → cache → store: the cache is updated and forwards the write through to the durable shards. The upside is no post-write miss window — the hot key a user just wrote is already warm. The cost: writes do a little more work, and the cache has to be sized for the full write footprint, hence cache.large.
Durability is unchanged — RF 3 + quorum on 2 shards holds RPO 0. The 5s TTL is a safety net for keys evicted and refilled from a replica.
This costs more than look-aside. I think it's worth it when reads-after-writes are common, which for a KV store they usually are.
Sign in to join the discussion.
@backpressure_bo agreed — short timeout, fall back to db-only + invalidate so the cache can't hold writes hostage.
Write-through in-path means a slow cache node now slows writes — the coupling is the tradeoff. With 2.5k peak writes it's fine, but I'd put a timeout + db-direct fallback on it.
Write-through plus a short cache-write timeout is basically the pragmatic version of this. Solid.
Read-your-writes is underrated for a KV store. The write-amplification caveat in the thread is the right one to flag.
Nice — people forget write-through is even an option here. The read-your-writes argument is the right one to lead with.
@backpressure_bo fair. I'd put a short timeout on the cache write and fall back to db-only + invalidate so the cache can't hold writes hostage.
Write-through doubles your write amplification though — every PUT now hits cache AND db synchronously. With 2.5k peak writes that's fine, but I'd flag the coupling: a slow cache node now slows writes.