Design a Result Cache in Front of Google Search Backends
Last updated: November 29, 2026
Quick Overview
Design a cache that stores full search result pages and partial results for repeated queries in front of Search's serving stack, keeping hit rates high while freshness-sensitive queries stay current.
0
0
0 solved
Design a cache that stores full search result pages and partial results for repeated queries in front of Search's serving stack, keeping hit rates high while freshness-sensitive queries stay current.
A Google screen question that tests caching judgment more than scale tricks. The interviewer checks cache key design, freshness and invalidation, personalization effects, and protection against stampedes.
What the Interviewer Expects
- Define a normalized cache key including locale and relevant context
- Explain why personalized parts should be cached separately or not at all
- Use TTLs tuned by query freshness class
- Prevent cache stampedes with request coalescing
- Estimate hit rate from query distribution
Key Topics to Cover
How to Approach This
- Start by clarifying functional and non-functional requirements with the interviewer.
- Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
- Draw a high-level architecture first, then deep dive into 1-2 critical components.
- Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
- Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
- How would you cache when part of the page is personalized?
- What TTL would you use for 'weather' versus 'pythagorean theorem'?
- How do you invalidate when the index updates for breaking news?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
- Cache results for repeated queries to reduce backend load and latency.
- Query distribution is heavy-tailed: a minority of queries account for a large share of traffic, but a large share of queries ...
High-Level Design
- Frontend normalizes the query (lowercasing, whitespace, Unicode normalization) and builds a key
(normalized_query, locale, country, device_class, safesearch, page). - **Distributed in-memory c...