Re:A Senior Engineer's Guide to the System Design Interview
by jeron on Thursday March 02, 2023 @04:03PM
(#35002044)
yeah, not sure what is too hard to understand about that. Perhaps it depends on the context but I highly doubt you can go wrong by saying a cache should be added to reduce latency.
[ Parent
| on HN ]
Re:A Senior Engineer's Guide to the System Design Interview
by lhorie on Thursday March 02, 2023 @04:39PM
(#35002455)
The way it typically fall aparts for my candidates is I ask about optimizations, they say X could be cached, then I ask about cache invalidation and lo and behold, it didn't even occur to them that the cache needs to be invalidated at some point, so they blurt something along the lines of doing the entire expensive operation again and checking it against the cache, or something similarly nonsensical.
More common than I'd like to admit.
Re:A Senior Engineer's Guide to the System Design Interview
by ThalesX on Thursday March 02, 2023 @05:25PM
(#35002953)
> then I ask about cache invalidation
No doubt with a follow up on how the variable would be best named.
Re:A Senior Engineer's Guide to the System Design Interview
by old_hat on Thursday March 02, 2023 @05:44PM
(#35003131)
That's obvious. It's called "x".
Re:A Senior Engineer's Guide to the System Design Interview
by Apocryphon on Thursday March 02, 2023 @06:05PM
(#35003359)
You mean x1
Re:A Senior Engineer's Guide to the System Design Interview
by nonethewiser on Thursday March 02, 2023 @06:09PM
(#35003385)
Isn’t it better to know you can add a cache to reduce latency, even if you’re not sure how to invalidate it?
Re:A Senior Engineer's Guide to the System Design Interview
by lhorie on Thursday March 02, 2023 @07:00PM
(#35003846)
The problem isn't demonstrating understanding of what a cache does conceptually, in fact any SWE worth their salt ought to be able to explain caching. The problem is if the candidate's decision to add a cache causes the system behavior to become obviously incorrect upon an ounce of further inspection, because this demonstrates a lack of foresight about local maxima vs global maxima, and systems are all about trade-offs at the macro scale.
Caching is an easy thing to blurt out in an interview setting, but not all problem spaces benefit from caching and caching often isn't the only available solution, or the most ideal one.
Re:A Senior Engineer's Guide to the System Design Interview
by Misdicorl on Thursday March 02, 2023 @11:00PM
(#35005635)
I started typing no, but then....
I honestly can't decide which would be worse: a developer who literally doesn't know what a cache is or one who installs caches with bad invalidation policies.
Re:A Senior Engineer's Guide to the System Design Interview
by N_A_T_E on Thursday March 02, 2023 @04:16PM
(#35002186)
Only two hard things in computer science, blah blah.
Re:A Senior Engineer's Guide to the System Design Interview
by mgraczyk on Thursday March 02, 2023 @06:15PM
(#35003444)
In practice, "latency" is too vague to be what matters. In many systems it's the worst 1% or 0.1% of latencies that matter. Adding a cache will improve latency in those cases only in some situations.
Usually adding caches helps by reducing load on the service behind the cache.