Top
Best
New

Posted by samuel246 7/1/2025

Caching is an abstraction, not an optimization(buttondown.com)
136 points | 128 commentspage 2
gmuslera 7/3/2025|
"fast storage" is about performance, your abstraction includes performance elements. If you go that down, then you are optimizing on your abstraction designs. What doesn't have to be wrong, but then don't say that is not optimization.
Joker_vD 7/3/2025||
There is also an important (but often overlooked) detail that you/your application may not be the only user of the cache. At which point caching, indeed, is an optimization via abstraction: when you fetch an X, you are in no position to predict that the next fifty completely unrelated to you requests would also want to fetch the same X, so it should probably be cached to be readily served.

Which is why solving the "I want my data in fast storage as often as possible" problem may be counter-productive on the whole: you ain't the only client of the system; let it breath and server requests from others.

kazinator 7/4/2025||
Optimization isn't separable from abstraction. Abstraction is something that can be implemented in more than one way, while meeting the terms of its contract. That flexibility allows for optimization.
zmj 7/3/2025||
This article is talking about single-writer, single-reader storage. I think it's correct in that context. Most of the hairy problems with caches don't come up until you're multi-writer, multi-reader.
scrubs 7/4/2025||
Ousterhout's grad students did work on ramcloud with some research at facebook and Amazon on cache use at scale in complex organizations.

One bit of interesting trivia say for facebook (from memory): if you add all the RAM caches in redis/memcached/disk + db caches to make the thing work at scale, then for about 20-30% more memory you could've had the whole thing in memory 100% of the time.

chrisjj 7/4/2025|
The problem there is /the whole thing/ grows - often faster than your memory.
scrubs 7/4/2025||
I think you need to read the papers.

Obviously things grow - look who i mentioned afterall.

The focus is on how you handle growth.

canyp 7/3/2025||
Did you hand-draw that graffiti? Never quite realized that graffiti of technical ideas looks really goated. Best part of the post, to be honest.
jxjnskkzxxhx 7/3/2025|
> looks really goated

Oof you're trying so hard you could cut diamond with that line.

canyp 7/4/2025||
I don't even understand what that means. Care to explain?
the__alchemist 7/4/2025||
I think it's a drug reference‽
kiitos 7/4/2025||
Cmd+F "invalidation" -- not found.

Author is talking about the least interesting, and easiest, piece of the overall caching problem.

eigenform 7/3/2025||
Even more obvious if you think about the case of hardware-managed caches! The ISA typically exposes some simple cache control instructions (and I guess non-temporal loads/stores?), but apart from that, the actual choice of storage location is abstracted away from you (and your compiler).
taeric 7/3/2025|
This reminds me of the use of materialized views as both a cache strategy and as an abstraction helper.
bravesoul2 7/3/2025|
And they too can slow things down. Like all caches can. Like Redis can. Cache is a leaky abstraction.

(Although a materialised view is more like an index than a cache. The view won't expire requiring you to rebuild.)

necovek 7/4/2025||
I believe this same language use is what makes this article confusing: Redis is not a cache, it is a key value store. Caching is usually implemented using key value stores, but it is not an abstraction (leaky or not).

In RDBMS contexts, index really is a caching mechanism (a cache) managed by the database system (query planner needs to decide when it's best to use one index or another).

But as you note yourself even in these cases where you've got cache management bundled with the database, having too many can slow down (even deadlock) writes so much as the database tries to ensure consistency between these redundant data storage elements.

bravesoul2 7/4/2025||
I thought Redis grew up as a KV cache and persistent storage came later.

In some sense though. If it ain't L1 it's storage :)

necovek 7/4/2025|||
Maybe Redis started up as an in-memory KV store focused on caching use cases, but it was still a KV store that could be used for caching, or not.

Even if you use "cache" in the name (eg. memcached), that's still not a cache, even if it's a KV store designed for caching.

More comments...