6 ms·
There are two hard problems in IT: cache invalidation, naming things and off-by-one errors.
by TobTobXX 4y ago
There are two hard problems in IT: cache invalidation, naming things and off-by-one errors.
- deleted 4y ago[deleted]
- ruuda 4y agoYou can eliminate the cache invalidation problem by not reusing old names for new things.
- onion2k 4y agoThat doesn't solve cache invalidation; that just means you're always invalidating the cache even in cases where you don't actually want to.
- rightbyte 4y agoYou just solve that by using another level of indirection. Duh.
- ithkuil 4y agoContent addressing causes the name to change only when the content changes, which also means the name doesn't change if the content doesn't change, this by definition you don't have spurious cache invalidations
- jakear 4y agoAnd how do you check what the new name of the content you haven't seen is?
- taeric 4y agoSerious question? There will be a root object that has a stable name through updates. When you write that, you embed current content hashes in it. Someone could get the cached of it, of course. But since it content addresses what it links to, it should avoid incoherent groups of cached data.
- jakear 4y agoI agree this would provide for increased coherency, but the additional indirection is hardly ideal. And really it's just kicking the caching problem up to a super-object that will probably be thrashed much harder than any individual file, and may be larger than each individual file. All in all it's a "certified hard problem", there's a bunch of domain specific nuance an HN thread couldn't hope to capture.
- taeric 4y agoThe extra indirection may or may not be a problem, of course. For a lot of places this is used, it is "index.html," after all. That said, I do find folks bend way too many things into fitting this pattern; such that I do not mean to be dismissive of the criticism.
- ilyt 4y agoBut where client gets the new name it should download for? As long as name client asks for (even if it is reference) is constant, it can have cache problems. Of course it makes it simpler as youc an opt to cache it so short that invalidation is less of an issue, but that's again working around cache invalidation
- onion2k 4y agoThere are many problems with that though. For example, if your CSS changes you change the filename... but now you need to change the HTML file that references it. You can't change that easily. Or what if your CSS change just deletes some unused classes... it'd be fine for users to keep the old version until it expires. If you rename the resource you'll be causing a lot of users to wait unnecessarily. Not a huge problem, unless you're Meta or Google. And so on. When people say cache invalidation is hard it's best to believe them, because it is.
- jonatron 4y agonewester_new_final_v4_new.txt
- deleted 4y ago[deleted]
- rightbyte 4y agoDoesn't that just move the problems to more "naming things" though?
- ithkuil 4y agoYes, naming things is intimately tied to cache invalidation. That's why the two things are together in that maxim. Not sure why people think it has to so with naming variables or functions...
- codetrotter 4y ago> Not sure why people think it has to so with naming variables or functions... I think it’s open to interpretation. And I think it is valid to apply the saying to naming of variables, functions, and many other things. See https://skeptics.stackexchange.com/questions/19836/has-phil-karlton-ever-said-there-are-only-two-hard-things-in-computer-science https://skeptics.stackexchange.com/questions/19836/has-phil-... Links to https://www.karlton.org/2017/12/naming-things-hard/ https://www.karlton.org/2017/12/naming-things-hard/ Links to a bunch of places. None of the ones I looked at seem to confidently say what was originally meant by the saying. Either way, regardless of what the guy meant when he originally used to say it, it’s allowed to apply a saying to new situations.
- CommitSyn 4y ago> That's why the two things are together in that maxim. I think you missed the joke.
- onlypositive 4y agoDid they?
- throwanem 4y agoNot using old names for new things in this case means abandoning the concept of Git branch tags.
- endymi0n 4y agoSounds a little bit like the standard recipe of any functional programming enthusiast: Just use pure functions! Except that they‘re colliding all the time with that tiny problem that the world isn‘t pure... People expect the same page at the same URL, with different content, tomorrow, so good luck choosing a different one than the one they have bookmarked and that ranks on Google. Caching doesn‘t get any less hard by trying to define the problem away.
- deleted 4y ago[deleted]
- Faaak 4y agoThe Oxford comma would be useful here
- YourDadVPN 4y agoYou pretty much never have a list where "things" is somewhere other than the end.
- tmtvl 4y agoThe edit adding ", concurrency," and updating "two" to "three" arrived before the message, so it wasn't applied.
- joshspankit 4y agoGithub raw seems like the simplest system for solving cache invalidation: invalidate the cache of a changed file when it’s pushed. They have access to both GitHub and the raw service. I know there are usually all sorts of layers between that make interconnectivity logistically complicated, but am I wrong that at the top-level it’s that simple?
- roundandround 4y agoThat is too simple for the feature they are using. The client itself has its own cache and the only way to fully prevent traffic from a client is to tell it content it caches will remain valid for some amount of time into the future. For URLs that return the latest entry there is no valid amount of time known in advance by GitHub unless they want to introduce mandatory publication delays. For URLs of specific change sets, they should never be corrected again and an infinite cache is pretty much valid unless a user overrides good git practices. I think GitHub frequently misidentifies which scenario they are in and when they return 1 day for a current state URL users notice, while when they return 5 minutes for a permanent change set that gets a lot if traffic they lost network capacity.
- stingraycharles 4y agoIsn’t this where stuff like ETAGs are supposed to help? Not completely solve, but at least help reduce the problem a bit more?
- ignoramous 4y agoYes, but cache invalidation is a hard problem, so most services side-step etags (+ if-none-match), only to hit caches elsewhere.
- flangola7 4y ago[flagged]
- joshspankit 4y ago
- airstrike 4y agoThere are actually only two hard problems in computer science: 0) Cache invalidation 1) Naming things 5) Asynchronous callbacks 2) Off-by-one errors 3) Scope creep 6) Bounds checking
- raverbashing 4y agoYou forgot the 'Segmentation Fault' at the last line
- wildcow 4y agoIt is on the list, but was never written to stdout because of a NULL pointer exception.
- marssaxman 4y agoHaven't seen that variant before! Thanks.
- ilyt 4y agoasynchronous callbacks are more of "wrong solution" than hard problem...
- Dylan16807 4y agoBounds checking as separate from off-by-one just means you stop using C arrays. That's not hard. And why point at callbacks specifically? And scope creep is not a computer science problem; it's easy to avoid if people decide to avoid it. So this list is too bloated for the joke to work well, I think. Even before we talk about how off-by-one gets ruined this way.
- latchkey 4y ago7) Yoda logic
- thih9 4y agoYou multithreading have forgotten.
- Retric 4y agoCache invalidation is a large class of multi threading problems, that’s just as much an issue between threads as between servers.
- nhumrich 4y agoAnd the oxford comma as well, apparently
- ravi-delia 4y agoThis is not actually a situation where the Oxford comma disambiguates, though I also had the gut feeling one should be there
- thfuran 4y agoThat's clearly a type of off by one error.