Design a scalable search service with sharding
Design a Scalable Search Service with Sharding
Design a search service that enables users to query documents or products using keywords.
Functional Requirements
GET /search?q=...endpoint should return top results ranked by relevance.- Support basic filtering capabilities, such as by category, language, or tenant/application ID.
- Achieve a P95 latency target of less than 200 ms.
- The service must be capable of scaling to accommodate very large corpora.
Non-Functional Requirements
- The data size is expected to grow to billions of documents.
- The system must handle frequent read operations and continuous ingestion/updates of data.
- High availability is a critical requirement.
Prompt
- Describe the high-level implementation of the core search algorithm, covering both indexing and querying processes.
- Propose a sharding strategy for the search index.
- Discuss the trade-offs associated with your design choices, specifically considering latency, cost, rebalancing, hot keys, consistency, and operational complexity.
While production-ready code is not required, be concrete in your discussion of components and data flows.
AI interview prep
Core dilemma
Balancing real-time search relevance and low-latency queries across a massive, continuously updating, sharded index, while ensuring high availability and managing operational complexity and cost.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Design a scalable search service with sharding
Design a Scalable Search Service with Sharding
Design a search service that enables users to query documents or products using keywords.
Functional Requirements
GET /search?q=...endpoint should return top results ranked by relevance.- Support basic filtering capabilities, such as by category, language, or tenant/application ID.
- Achieve a P95 latency target of less than 200 ms.
- The service must be capable of scaling to accommodate very large corpora.
Non-Functional Requirements
- The data size is expected to grow to billions of documents.
- The system must handle frequent read operations and continuous ingestion/updates of data.
- High availability is a critical requirement.
Prompt
- Describe the high-level implementation of the core search algorithm, covering both indexing and querying processes.
- Propose a sharding strategy for the search index.
- Discuss the trade-offs associated with your design choices, specifically considering latency, cost, rebalancing, hot keys, consistency, and operational complexity.
While production-ready code is not required, be concrete in your discussion of components and data flows.