Project 14
Ride-hailing platform
Geospatial data, real-time matching
Brief
Riders request trips; nearby drivers are matched; live location tracking; the trip lifecycle; surge-pricing awareness; both apps on flaky mobile networks.
Targets
1M active drivers reporting location every 4 s · match p99 < 3 s · location ingest may be lossy, matching state may not · city-level failure isolation.
Must cover
- Geospatial lookup — cells and "drivers near me" (→ 210).
- One driver per trip — a lease-based reservation, no double-assignment (→ 137).
- Location freshness — staleness bounds on driver positions, and what matching does with stale data (P).
- Dispatch offer expiry — offer, accept, timeout, re-offer (P).
Design challenges
- Geospatial indexing (→ 210): geohash/H3 cells; cell-size trade-off; hot cells at airports (→ 88).
- Location ingest: 250k writes/sec, last-write-wins per driver, in-memory store — deliberately not the system of record (→ 87, 129).
- Matching: the offer/accept protocol with timeouts; the driver locked while deciding — a reservation with a lease (→ 137).
- Trip state machine synchronized across two unreliable mobile clients (→ 46, 40).
- Geo-partitioning by city as the scaling and failure-isolation unit (→ 142; → 193 — ahead, Part 12; cells → 212).
- The quoted price honored despite surge changes — snapshot at request time (→ 129).
Out of scope
Routing and ETA computation internals (the maps service is external); payments (Project 8).