Design a Search Autocomplete System
Last updated: September 4, 2025
Quick Overview
Build a query suggestion system with prefix matching, personalization, trending detection, and strict latency requirements under P99.
Perplexity
System Design
Software Engineer
Perplexity
September 4, 2025Software Engineer
System Design Round
System Design
Medium
7
10
3,860 solved
Build a query suggestion system with prefix matching, personalization, trending detection, and strict latency requirements under P99.
Autocomplete is a key UX feature for search products. This tests real-time data structures and ranking under tight latency constraints.
What the Interviewer Expects
- Design efficient prefix matching with tries or inverted indexes
- Implement trending query detection with decay functions
- Add personalization based on user history
- Meet P99 latency under 50ms
- Blend ML-scored suggestions with rule-based boosting
Key Topics to Cover
Trie data structures
Prefix matching
Trending detection
Personalization
Low-latency serving
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 do you handle offensive or dangerous query suggestions?
- How do you cold-start personalization for new users?
- What happens when trending queries spike suddenly?
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
Functional Requirements:
- Prefix Matching: The system should provide query suggestions based on the prefix of what the user types.
- Personalization: Suggestions should be tailored ...
Capacity Estimation
Assuming Perplexity has around 1 million active users daily, with an average of 5 searches per user per day, we estimate:
- Total Searches per Day: 1,000,000 users * 5 searches = 5,000,000 sear...
Submit Your Answer
Markdown supported