We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
2 system design questions lean on this idea. 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
Write-back and write-behind are two names for the same pattern, and both appear in the literature and in library documentation. This lesson uses write-behind throughout, because the behaviour it names is the one that matters: the write goes to the cache, and the store is updated behind it.
The previous lesson treated it as write-through with the acknowledgement moved earlier, which is the usual description and is where the discussion normally stops. The win is real and it is the small half.

A write-behind cache holds a dirty set and flushes it on a schedule. If the same key is written ten times between two flushes, the store receives one write.

Writing the same key again replaces what is already there, so only the last value is ever flushed, and the reduction is exactly the number of repeats inside the interval.

A flush every one second cut store writes from 400,000 to 167,132, which is 2.39 times less work, in exchange for one second of exposure.

The curve is steep and then flat. Most of what buffering can do for you is done within a second, because a Zipf head is rewritten within a second and the tail is not rewritten at all however long you wait.

It is easy and good
“It is really nice and good Please join the course”
The coalescing curve flattens. These two do not. Both grow linearly with the interval while the benefit grows logarithmically, so the useful range is narrow and it is at the short end.
Pick the interval from how much acknowledged data you can afford to lose, then check that the coalescing it gives you is worth having. Choosing it from the coalescing curve is backwards.