Tutorials System Design Mastery

The Caching Strategy: Write-Through vs Write-Back vs Cache-Aside

On this page

Enterprise Caching Strategies

Caching is the #1 way to scale a high-traffic application. But "Where" and "When" you update the cache determines the reliability of your data.

1. Cache-Aside (Lazy Loading)

The application checks the cache. If it's a "Miss," it fetches from the DB and stores it in the cache for next time. Pros: Efficient memory use. Cons: The first request is always slow.

2. Write-Through

Data is written to the cache AND the database simultaneously. The write is only considered finished when both are updated. Pros: Data in the cache is never stale. Cons: Heavy write latency.

3. Write-Back (Write-Behind)

Data is written only to the cache. The cache then syncs with the database in the background every few minutes. Pros: Insanely fast writes. Cons: If the cache server crashes before syncing, you lose data.

4. Interview Mastery

Q: "Which strategy would you use for a high-frequency trading platform vs a social media profile?"

Architect Answer: "For a profile, **Cache-Aside** is perfect. It's okay if the first person to see a new profile has a 50ms delay. For high-frequency trading where every microsecond counts, I'd use **Write-Back** to keep the performance near-instant, provided I have a high-availability Redis cluster to mitigate the risk of data loss."

Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

System Design Mastery
Course syllabus
1. Distributed Systems Fundamentals
2. Database Scalability
3. Caching & CDN Strategies
4. Event-Driven Architecture
5. High Availability & Load Balancing
6. Microservices & API Gateway
7. Monitoring & Disaster Recovery
8. FAANG System Design Interview
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details