Product Catalog Service Design
You are tasked with designing a product catalog service for an e-commerce site. The system should primarily handle a read-heavy workload, utilize a relational database as its primary data store, and expose its functionalities via JSON over HTTP APIs.
Requirements
-
Data Model
- Implement hierarchical categories using a self-referential
Categorytable, demonstrating the self-join mechanism for parent-child relationships. - Products must be able to belong to multiple categories.
- Model product variants (e.g., size, color) and support arbitrary attributes for products.
- Specify a detailed relational schema, including tables, primary/foreign key fields, and appropriate indexes.
- Implement hierarchical categories using a self-referential
-
APIs
- Provide endpoints for creating and updating products and categories.
- Implement an API for browsing products by category, including support for pagination and filtering.
- Develop an API for searching and filtering products based on their attributes.
- Create an API to fetch detailed information for a single product.
- Include example API endpoints with illustrative request and response payloads, demonstrating pagination and filtering syntax.
-
Architecture/Operations
- Discuss various consistency choices across different data layers (e.g., primary database, cache, search index).
- Detail caching strategies and their implementation.
- Describe read/write patterns and how they are handled.
- Explain how the system would scale to support 10 million products and approximately 1,000 queries per second (QPS) for reads.
Assumptions
- APIs will follow a RESTful style, using JSON for data exchange.
- Pricing and inventory management may be handled by separate services.
- The system will initially manage 10 million products, with typical products having a few variants.
- Peak read QPS is estimated at 1,000, with write operations occurring at a significantly lower frequency.
AI interview prep
Core dilemma
Optimizing for high-volume, low-latency reads of complex, interconnected product data while maintaining data consistency across multiple storage layers and ensuring efficient search/browsing capabilities.
3 tradeoffs and 3 stress tests locked
Interview prep
Unlock the interviewer X-Ray rubric, tradeoff matrix, stress tests, clarifying questions, and key concepts.
Product Catalog Service Design
You are tasked with designing a product catalog service for an e-commerce site. The system should primarily handle a read-heavy workload, utilize a relational database as its primary data store, and expose its functionalities via JSON over HTTP APIs.
Requirements
-
Data Model
- Implement hierarchical categories using a self-referential
Categorytable, demonstrating the self-join mechanism for parent-child relationships. - Products must be able to belong to multiple categories.
- Model product variants (e.g., size, color) and support arbitrary attributes for products.
- Specify a detailed relational schema, including tables, primary/foreign key fields, and appropriate indexes.
- Implement hierarchical categories using a self-referential
-
APIs
- Provide endpoints for creating and updating products and categories.
- Implement an API for browsing products by category, including support for pagination and filtering.
- Develop an API for searching and filtering products based on their attributes.
- Create an API to fetch detailed information for a single product.
- Include example API endpoints with illustrative request and response payloads, demonstrating pagination and filtering syntax.
-
Architecture/Operations
- Discuss various consistency choices across different data layers (e.g., primary database, cache, search index).
- Detail caching strategies and their implementation.
- Describe read/write patterns and how they are handled.
- Explain how the system would scale to support 10 million products and approximately 1,000 queries per second (QPS) for reads.
Assumptions
- APIs will follow a RESTful style, using JSON for data exchange.
- Pricing and inventory management may be handled by separate services.
- The system will initially manage 10 million products, with typical products having a few variants.
- Peak read QPS is estimated at 1,000, with write operations occurring at a significantly lower frequency.