Design an E-Commerce Recommendation System from Browsing History
OracleSoftware Engineer · OnsiteLast updated
This problem tests the ability to architect a scalable, low-latency recommendation engine that translates real-time user activity into personalized product suggestions.
Problem Statement
Design a recommendation system for an e-commerce platform that suggests relevant products to users based on their real-time browsing history. The system must handle high traffic volumes and update suggestions as a user navigates through the site.
Functional Requirements
- Capture and process user clickstream data in real-time.
- Provide personalized product rankings (top-K) for a specific user ID.
- Support "Related Items" suggestions based on the current product page view.
Non-Functional Requirements
- Latency: Recommendation requests must return in under 100ms.
- Scale: Support 10,000 requests per second (RPS).
- Availability: The system should remain functional even if the primary recommendation model is temporarily down.
Deliverables
Your response should cover the following:
- Data Flow: How do you ingest clickstream data, and how do you store user profiles/history?
- Model Architecture: Choose a candidate generation and ranking strategy (e.g., collaborative filtering vs. content-based vs. embeddings).
- API Design: Define the necessary endpoints for the frontend to consume.
- Storage: Decide on the database choice for user features and product metadata.
- System Architecture: Propose a high-level design diagram, including caching strategies and potential trade-offs between accuracy and latency.
Hints
Hint 1
Consider a two-stage approach: candidate generation (retrieving a large set of potentially relevant items) followed by a fine-tuned ranking layer.
Hint 2
Think about using an asynchronous message queue (e.g., Kafka) to decouple real-time data ingestion from model inference.
Hint 3
Address the cold-start problem: how do you handle users or products with no historical data?
Follow-up questions
- How would you handle a sudden surge in traffic during a seasonal sale (e.g., Black Friday)?
- How do you evaluate the performance of your recommendation engine using offline metrics versus online A/B testing?
- How would you ensure user data privacy while maintaining the personalization quality of the system?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.