All jobs / Backend developer / Architecture
Backend developer interview question · 0–1 years
When does adding a cache help, and when does it not?
The strongest answer
It helps when the same data is read far more often than it changes and a slightly stale answer is acceptable; it does not help write-heavy paths, unique-per-request data, or when staleness is unacceptable
Why it works
Right. Read-heavy, repeated, staleness-tolerant — otherwise it adds complexity for nothing.
What a good answer covers
- Read-heavy and repeated.
- Staleness must be acceptable.
- Not for writes or unique reads.
- Name what is cached and for how long.
Answers that fall short
- Close, but not the strongest: A cache always helps because memory is faster than disk
A cache with no hits is pure overhead. - Weak: It helps writes by buffering them
That is a queue, not a cache. - Red flag: It only helps static files
Caches sit in front of any repeated read.
Who gets asked this
- Backend developer
- Full-stack developer
- DevOps / SRE / cloud
- Data engineer
- Data science / ML / AI
- Engineering manager / tech lead
- Solutions / cloud architect
- AI engineer
More Architecture questions
- In a design, why do you say which columns are indexed?
- What is a read replica for?
- Why would you put a queue between two parts of a system?
- What is the difference between latency and throughput?
- An interviewer asks for p99 latency. What does that mean and why ask for it?
- How do you estimate storage for 100 million short URLs?
- What does a CDN do for a web application?
- Why would a class take its database client as a constructor parameter instead of creating one inside itself?