Caching Can Accidentally Destroy Your Database
Caching is supposed to reduce database load. But sometimes it does the opposite. This happens during a cache stampede.
🧵
#systemdesign#caching#software#engineering
The lesson
At scale, intuition isn’t enough.
Visibility into usage patterns drives the biggest savings.
Your cloud bill is an engineering problem.
Treat it like one.
Canva’s $3.6M Cloud Cost Lesson
Scaling to 100M+ users creates a new problem.
Cloud costs.
Canva stores more than 230 petabytes of data on Amazon S3.
Most of it is user-generated designs.
#CloudComputing#AWS#CostOptimization#canva
They identified:
• infrequently accessed data
• large objects
• buckets with strong savings potential
Only those datasets were migrated
The results
• 80B objects migrated in ~2 days
• 130+ PB moved to Glacier Instant Retrieval
• $300K saved per month
• $3.6M saved annuall
When engineers hear “caching,” they usually think of Redis. But caching exists in multiple layers of a system.
In fact, many systems already use caching without developers realizing it. Here are some common caching layers.
🧵
#SystemDesign#web#software#engineering#backend
In practice, engineers often mix the terminology.
What matters most is whether your data lives on one machine or many.
#databases#partitioning#sharding
Partitioning and Sharding Are Not the Same Thing (Even Though People Use Them That Way)
Engineers often use partitioning and sharding interchangeably.
But technically, they are different.
Understanding the difference matters when designing systems.
#systemdesign#interview
You should explain:
• why the database is a bottleneck
• what data should be cached
• how cache updates happen
Caching is powerful, but only when the problem actually requires it.
Most Engineers Introduce Caching Too Early in System Design Interviews
Many candidates jump straight to “let’s add Redis.”
But good system design answers don’t start with caching.
They start with identifying the actual bottleneck.
🧵
#systemdesign#interview#caching#software
most reads are served from memory. That allows the database to focus on writes and less frequent reads.
However, caching introduces new problems:
• stale data
• cache invalidation
• cache failures
• hot keys
That’s why in interviews you shouldn’t just say “we’ll add Redis.”