We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
This idea carries a full system design question on its own. Each walks through the full answer.
System Design Masterclass · Caching Strategies
Free preview: the first 2 parts of this 10-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design courseread the rest of this lesson in
System Design Masterclass
Unlock this lesson and the 751 other paid lessons
$25 once, by PayPal
See the System Design coursein Caching Strategies
This lesson is part of the full System Design Masterclass. Unlock it along with 769 other lessons for a one-time payment.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime Access18 Foundation lessons are free, no payment needed. Try them now
It is easy and good
“It is really nice and good Please join the course”
Write-through sends every write to the cache and to the store together, so the cached copy is never behind. That is a real property and it is why the pattern exists.

There is no invalidation to get right, because nothing is ever left stale. And every write now occupies a slot that some other entry was using.
The consistency argument is sound, and this lesson is about the second sentence. A cache is a fixed number of slots, and write-through decides how some of them are spent.

A user editing their own profile, an order being updated, an inventory count changing. Every one of those is roughly as likely as any other, and almost none of them is a popular item.

Write-through took the read hit rate from 71.5 percent to 68.3, without a single change to the read traffic. The cache is perfectly consistent throughout, and it answers fewer questions.

Consistency and hit rate are different quantities, and this pattern trades one for the other. That trade is worth making in plenty of systems, and it should be made knowing that it is a trade.

Each of those was a cache write, a serialisation, a network round trip on a shared cache, and a slot taken from an entry that reads were asking for.