Got grilled on this way harder than I expected.
Start by clarifying requirements and scale, then design a high-level architecture that separates location indexing, query processing, and ranking. Focus on geospatial indexing and efficient retrieval, and discuss trade-offs between consistency, latency, and cost.
Pro tip: Emphasize how you would handle real-time updates and ensure low-latency queries at scale, as Uber operates in a dynamic environment with millions of users and restaurants.
Ask about functional and non-functional requirements: search radius, ranking criteria (distance, rating, popularity), update frequency, expected QPS, and latency SLA.
Outline components: a geospatial index (e.g., geohash, quadtree), a database for restaurant metadata, a query service, and a ranking service. Consider using a CDN for static assets.
Explain how to index restaurant locations for efficient nearby search. Compare geohash, quadtree, and R-tree, and discuss how to handle updates and queries.
Describe how to retrieve candidate restaurants within a radius, then rank them using factors like distance, user preferences, and real-time popularity. Discuss caching strategies.
Address scaling: sharding by region, read replicas, and handling hot spots. Discuss trade-offs between consistency (e.g., eventual vs. strong) and latency, and how to monitor and optimize.
AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.