All insights
ArchitecturePerformance · 4 min read

Caching invalidation: just say no

If you can solve a performance problem without adding a cache, do that. Caches are the source of more outages than the problems they solved.

Caching is a deal you make with future you. You get faster reads now, in exchange for owning every cache invalidation bug for the rest of the system’s life. It’s a worse deal than it looks, especially the first time you reach for it.

Try these first

  • Index the database properly.
  • Optimize the query that’s actually slow.
  • Move computation to write-time, not read-time.
  • Denormalize where it actually matters.

When caching is actually right

Read-heavy data that changes infrequently. Expensive computations that have a clear key. Cases where stale data is acceptable for a known window. If any of those don’t hold, you’re signing up for invalidation bugs for an unclear payoff.

Add caches like you’d add diet pills, only when the simpler thing has failed.

Have something that should run itself?

Tell us what runs by hand today. We reply within one business day with a first idea.