Interview › Databases & Caching
How would you design caching for a read-heavy microservice?
Databases & Caching · Advanced level
Answer
For a read-heavy microservice, I cache hot, expensive, safe-to-stale data using clear key naming, TTL plus jitter, explicit invalidation, request coalescing, warming, and fallback protection for the database.
Technical explanation
Start from metrics: hot endpoints, expensive queries, result size, and allowed staleness.
Use Redis/Valkey shared cache for common data and local cache for tiny ultra-hot config.
Protect the database from miss storms with coalescing, warmup, and fallback rate limits.
Hands-on example
Read-heavy product cache:
product:v3:{id} TTL 15m+jitter
product-price:v1:{id} TTL 60s plus explicit invalidation
Redis timeout 50ms.
On miss, coalesce requests and rate-limit DB fallback.
Check how well your resume matches the role with our free resume checker— match score, ATS check, and the skills you're missing.
More Databases & Caching interview questions
- What is Amazon RDS, and what does it manage for you versus self-managed databases?
- What database engines does RDS support?
- What is the difference between RDS and Aurora?
- What is Multi-AZ in RDS, and how does automatic failover work?
- How long does an RDS Multi-AZ failover typically take, and what triggers it?
- What is the difference between Multi-AZ and a read replica?
- When would you use a read replica, and can it become a standalone database?
- Can a read replica be in a different region, and why would you do that?