Design a Low-Latency Store Recommender
DoorDashData Scientist · OnsiteLast updated
This question assesses the ability to architect a multi-stage recommendation pipeline that balances low-latency retrieval with high-accuracy ranking in a geo-aware, high-concurrency food delivery context.
Scenario
DoorDash needs to recommend stores to a user within 50ms of a request. The user is browsing in a specific geohash, and we have millions of stores with dynamic features (e.g., store delivery time, promotional status) and user features (e.g., recent order history, dietary preferences).
Task
Design a scalable system that provides real-time store recommendations. Your response should address the following areas:
- Pipeline Architecture: Describe the stages from candidate retrieval to final ranking (e.g., how do you handle millions of stores to produce a top-k list?).
- Feature Engineering & Serving: How do you manage real-time updates for features like 'current estimated delivery time' or 'store busy status' while maintaining sub-millisecond lookups?
- Geo-Sharding: How does the system handle geospatial constraints? How do you partition the data to ensure the store index is queryable by current user location?
- Non-Functional Requirements: Address how you handle high request volume, system cold starts, and model deployment (e.g., A/B testing and canary rollouts).
Constraints
- Latency budget: < 50ms end-to-end.
- Traffic: 100k requests/second at peak.
- Consistency: Store availability must be highly accurate to prevent negative user experience.
Deliverables
- A high-level system diagram description.
- A brief justification for your choice of retrieval and ranking models.
- Strategies for caching vs. computation trade-offs.
Hints
Hint 1
Consider using a two-tower architecture or approximate nearest neighbor (ANN) search for the retrieval phase to narrow the candidate pool efficiently.
Hint 2
Think about the difference between static features (user location history) and transient features (store kitchen capacity) and how to serve them via different data stores (e.g., Key-Value stores vs. Feature Stores).
Hint 3
Evaluate the trade-off between strict consistency and eventual consistency for real-time signals like 'Store Busy' status.
Follow-up questions
- How would you measure the performance of this system using offline metrics (NDCG, Recall) versus online metrics (Conversion Rate, Mean Time to Order)?
- If you detect a significant shift in store data distribution, what automated mechanisms would you implement to trigger model retraining or adjustments?
- How would you modify the ranking layer to ensure diversity in the recommendations (e.g., avoiding only showing fast-food chains)?
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.