← Create New Paste

Design a Ride-Sharing Service: A System Design Interview Walkthrough

2 views
"Design Uber" or "design a ride-sharing app" is a popular system design interview question because it combines real-time location data, matching, high write throughput and strict latency requirements. Here is a step-by-step way to approach it in a 45 to 60 minute interview. Clarify requirements Functional requirements usually include: riders request a ride from a pickup location, the system finds a nearby available driver, the driver accepts, both see each other's location in real time, and the trip is priced and paid at the end. Non-functional requirements: low matching latency (a few seconds), high availability, and the ability to handle millions of location updates per minute. Ask whether surge pricing, ride pooling and scheduled rides are in scope; often they are follow-up discussions. Estimate the load Suppose there are 1 million active drivers, each sending a location update every 4 seconds. That is around 250,000 writes per second, which tells you location updates should not go straight into a traditional relational database. Saying this out loud shows the interviewer you use numbers to drive design decisions. High-level components - Location Service: receives driver GPS updates and keeps the latest position in memory, for example in Redis. - Geospatial index: divides the map into cells using geohashes, quadtrees or a hexagonal grid such as H3, so "find drivers near this point" only searches a few cells. - Matching (Dispatch) Service: given a ride request, queries nearby available drivers, ranks them by estimated time of arrival, and sends offers. - Trip Service: manages the trip state machine (requested, accepted, in progress, completed, cancelled) in a durable database. - Pricing and Payment Services: calculate fares, apply surge multipliers and charge the rider through a payment provider. - Notification Service: pushes updates to rider and driver apps via WebSockets or mobile push. Matching details Explain how you avoid offering one driver to two riders at the same time: lock or reserve the driver in the dispatch service with a short time-to-live, and release the lock if the driver declines or the offer times out. Discuss partitioning dispatch by city or region so each shard handles a manageable area. Real-time tracking During a trip, driver location updates are relayed to the rider through persistent connections. You do not need to store every point permanently in a hot database. Stream them to a log such as Kafka for later analytics and ETA model training. Reliability and trade-offs Talk about what happens if a region's dispatch service fails, how you handle drivers with poor connectivity, and the trade-off between update frequency and battery or bandwidth usage. Interview tip Keep checking in with your interviewer about which area they want to go deeper on. If you want extra support, Linkjob AI (https://linkjob.ai) offers real-time help during live job interviews and technical interviews, helping candidates keep a clear structure. Practicing this walkthrough out loud a few times makes a big difference.
Created Nov 15, 2026 19:03 Expires Nov 15, 2027 19:03