Design a Search Autocomplete System at TikTok Scale

Last updated: March 3, 2025

Quick Overview

Build typeahead suggestions with prefix matching, personalization, trending detection, and sub-100ms latency for billions of daily queries.

ByteDance
System Design
Software Engineer
ByteDance
March 3, 2025
Software Engineer
System Design Round
System Design
Medium

9

3

4,297 solved


Build typeahead suggestions with prefix matching, personalization, trending detection, and sub-100ms latency for billions of daily queries.

Standard but scaled to ByteDance's volume. Tests data structure choice and ranking under tight latency constraints.

What the Interviewer Expects
  • Design efficient prefix matching with tries or inverted indexes
  • Implement trending query detection
  • Add personalization based on user history
  • Meet sub-100ms P99 latency
  • Handle offensive query filtering
Key Topics to Cover
Trie data structures
Prefix matching
Trending detection
Personalization
Low-latency serving
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you handle multi-language autocomplete?
  • How do you detect and suppress dangerous search suggestions?
  • What is your cold-start strategy for new users?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Functional Requirements:
    1. Provide typeahead suggestions for user queries using prefix matching.
    2. Implement personalization based on user search history and preferences.
    3. Detect and s...
Capacity Estimation
  • User Base: Assume TikTok has 1 billion active users.
  • Queries per User: Let's estimate an average of 10 search queries per user per day.
  • Total Queries: 1 billion users * 10 queries/us...

Submit Your Answer
Markdown supported

Related Questions