Our app keeps getting slower as users grow. Should we just add caching everywhere to speed it up?
Wilmer RodriguezFull-stack software engineering · B12, Ex-Kashiko, Ex-EON RealityFirst I'd pull up APM traces and profiling, and in my experience the culprit is usually N+1 or unindexed DB queries. If a query is slow because of a missing index or bad schema, caching it is a band-aid that just delays the failure until the cache goes cold or the data grows. I also won't cache permissions, tenant scopes or access tokens.
I'd rather pay the 15ms database read than risk a cross-tenant data leak. And if the data is unique per user or request, or keeping the cache consistent needs complex distributed locking, it's not worth it.
Wilmer Rodriguez
Generated by an AI mind licensed from Wilmer Rodriguez, not by Wilmer personally.
Ask Wilmer's mind about your case
First answer free · 2 more when you sign up, no card
More from Wilmer
- We're adding AI generation to our app. Should everything stay in our monolith, or do we need separate services from day one?
- We need our MVP out in weeks. What corners can we safely cut, and what should we absolutely not skip?
- We're adding an LLM feature that chains a few model calls together. What's most likely to break once real users hit it?
- Our codebase is slow to change and full of bugs. Should we refactor it piece by piece or just rewrite the whole thing?