4 ms·
Ugh. I had a colleague that addressed any scaling problem by putting a cache in front of the DB. Praised for solving the immediate problem, but shouldered none
by iamwil 3y ago
Ugh. I had a colleague that addressed any scaling problem by putting a cache in front of the DB. Praised for solving the immediate problem, but shouldered none of the costs. </rant>
I admit in the face of finding Prod/market fit, you do the expedient thing, but damned if I'm not often at the receiving end of these sorts of decisions.
- aidos 3y agoInterestingly, I often ask candidates about optimising a slow running db query and the majority of people jump to adding caching and very few ask if they can run an explain or see the indexes.
- tedunangst 3y ago"I would make the slow query faster" seems too obvious an answer for an interview question.
- pphysch 3y agoThe question is usually phrased like "what would you check/do if you had a page that was taking many seconds to load".
- aidos 3y agoHaha, sure, but the very first thing you should ask when faced with a slow query is to see the “explain analyse” output. Caching, in any form, is the last thing you want to reach for because it’s always more nuanced than you anticipate. To clarify, when asking the question it’s after drilling through the layers from the frontend -> backend -> query and the actual query is on the screen along with some table metrics as a guide.
- FridgeSeal 3y ago“Just put a cache in front of it to speed it up” is up there along with everyone’s favourite misunderstood “(premature) optimisation is the root of all evil” when it comes to performance and efficient software in my opinion. Caching is mostly a lie. Redis will not “make” your application faster. It will just let you pretend the problem doesn’t exist for a while, and then when the caching eventually falls over, you will be even more stuck, because you’re now past your scaling limits, with no more defenses left and software that has been (continually) built without the understanding of its performance requirements.