Design trending queries ranking system
Design Trending Queries Ranking System
You are tasked with designing a system to display Top Trending Queries on the homepage of an AI search and Q&A platform. This system should identify and rank queries that are rapidly increasing in popularity. Initially, the list can be global, but the design should accommodate future personalization based on factors like country, language, or user interests.
Requirements and Goals:
- Identify queries that are "trending" (rising in popularity) in near real-time.
- Rank the top K trending queries for the homepage.
- Support global trending queries.
- Support trending queries segmented by region or other criteria (e.g., country, language, topic).
- Enable personalization to show trending queries relevant to specific users or segments.
- Handle high query volumes (tens of thousands of QPS).
- Ensure results are updated within seconds to a few minutes.
Design Task:
Describe the design of this trending queries system, covering:
- Collection and processing of raw query events.
- Definition and computation of "trending" (focusing on spikes and velocity, not just absolute popularity).
- Data architecture for real-time or near-real-time aggregation (streaming vs. batch).
- Storage and serving of top K trending queries globally and by segment.
- Strategies for adding personalization over time.
- Key metrics, scaling considerations, and handling spam/abuse.
Focus on describing main components, data flows, and algorithms or approximations (e.g., for top-K), rather than providing code.
AI interview prep
Core dilemma
Balancing the need for near real-time detection of query velocity spikes against the computational cost and complexity of processing massive query volumes, while also preparing for future personalization.
3 tradeoffs and 2 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design trending queries ranking system
Design Trending Queries Ranking System
You are tasked with designing a system to display Top Trending Queries on the homepage of an AI search and Q&A platform. This system should identify and rank queries that are rapidly increasing in popularity. Initially, the list can be global, but the design should accommodate future personalization based on factors like country, language, or user interests.
Requirements and Goals:
- Identify queries that are "trending" (rising in popularity) in near real-time.
- Rank the top K trending queries for the homepage.
- Support global trending queries.
- Support trending queries segmented by region or other criteria (e.g., country, language, topic).
- Enable personalization to show trending queries relevant to specific users or segments.
- Handle high query volumes (tens of thousands of QPS).
- Ensure results are updated within seconds to a few minutes.
Design Task:
Describe the design of this trending queries system, covering:
- Collection and processing of raw query events.
- Definition and computation of "trending" (focusing on spikes and velocity, not just absolute popularity).
- Data architecture for real-time or near-real-time aggregation (streaming vs. batch).
- Storage and serving of top K trending queries globally and by segment.
- Strategies for adding personalization over time.
- Key metrics, scaling considerations, and handling spam/abuse.
Focus on describing main components, data flows, and algorithms or approximations (e.g., for top-K), rather than providing code.