Design Document-Sharded Inverted Index Serving for Web Search
Last updated: November 29, 2026
Quick Overview
Design the serving layer of a web search engine that holds an inverted index over tens of billions of documents and returns the top results for a query in under 200 ms.
Google
System Design
Software Engineer
Software Engineer
System Design Round
System Design
Hard
0
0
0 solved
Design the serving layer of a web search engine that holds an inverted index over tens of billions of documents and returns the top results for a query in under 200 ms.
A hard Google Search infrastructure question. The interviewer probes document versus term partitioning, scatter-gather with tail latency control, tiered indexes, replication, and how a query fans out and merges ranked results.
What the Interviewer Expects
- Compare document partitioning and term partitioning
- Design scatter-gather with replicas and hedged requests
- Use index tiers so most queries touch only the best documents
- Compress posting lists and keep hot parts in memory
- Merge per-shard top-k results and then re-rank
- Estimate shard counts and memory
Key Topics to Cover
inverted index
document partitioning
scatter-gather
tail latency
posting list compression
tiering
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
- Why does Google-style search prefer document partitioning?
- How do you keep p99 latency low when one of 1,000 shards is slow?
- How would you push index updates without taking shards offline?
- How do you handle a query like 'the' with huge posting lists?
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
- Index: 50B documents. Query rate: ~100k QPS. Latency budget: ~200 ms end to end, ~50 ms at index servers.
- Return top 10 results after first-pass retrieval and a heavier ranking pass.
- High availa...
High-Level Design
- Query frontend parses, spell-corrects, expands, then sends to a root server.
- Root fans out to leaf index shards. Each leaf holds a slice of documents and their full posting lists (docu...
Submit Your Answer
Markdown supported