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 Reality

First 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