<aside>

This section is part of the 5-hour System Design course by Mukul Raina

SLIDE 80: Section Intro, Matching and Dispatch

Section 7: Matching and Dispatch

image.png

Matching is the core problem that separates a ride-sharing platform from every other type of system you will design in an interview. Content platforms distribute static content. E-commerce platforms match buyers with inventory. A ride-sharing platform must match two moving entities in real time, under tight latency constraints, while preventing conflicts across concurrent requests. The engineering is in the matching, not the map.

This section builds directly on two previous sections. The spatial index from Section 6 provides the “find nearby drivers” query that feeds into matching. The Trip Service orchestrator from Section 4 coordinates the flow between Matching, Dispatch, and ETA. Here, we go inside those services to understand how candidate selection, scoring, offer dispatch, and conflict resolution actually work.

What We’ll Cover:

  1. Why matching is not just “find the closest driver”
  2. Greedy matching: simple, fast, locally optimal
  3. Batch matching: slower, globally optimal
  4. Greedy vs batch trade-offs and when to use each
  5. Candidate selection pipeline: from 50K drivers to 1 match
  6. Multi-factor scoring and ranking
  7. Dispatch flow: offer, accept, decline, timeout, cascade
  8. Race conditions: two riders competing for the same driver
  9. ETA estimation with graph-based routing
  10. Geographic partitioning for matching at scale

Interview Pacing:

In a 45-minute interview, matching and geospatial together occupy minutes 20-28. You have approximately 4-5 minutes for matching. Lead with the candidate pipeline (filter, score, rank), explain greedy vs batch as a trade-off, and describe the dispatch offer-accept-decline cycle. If the interviewer pushes on concurrency, discuss the locking strategy for preventing double-booking.