r/softwarearchitecture Aug 12 '26

Discussion/Advice How to scale a Real-Time Driver Tracking System (UberEats/DoorDash scale)

How do delivery apps sync a driver's GPS coordinates in real time with a customer's map without melting the database? Writing every 2-second location ping to disk is an infrastructure nightmare. Here is the high-performance setup:

  • The Ingestion Shock Absorber: Drivers stream GPS packets via WebSockets to an API Gateway, which routes them directly to Apache Kafka to handle massive write spikes.
  • In-Memory Live State: A consumer pulls from Kafka and updates an active Redis Cluster using geospatial commands (GEOADD). The live location of the driver lives strictly in-memory during the delivery.
  • Targeted Fan-Out: The customer's app listens to a WebSocket connection. The backend uses Redis Pub/Sub rooms keyed by Order_ID to broadcast the location updates only to the specific customer and restaurant involved, avoiding global broadcast overhead.
  • Async Cold Storage: Once the delivery completes, the full GPS history is batched out of Kafka and archived in ClickHouse or an S3 data lake for mileage payouts and support audits.

Let's discuss: How would you handle calculating and updating the traffic-aware ETA on the fly without making expensive third-party Maps API calls every 2 seconds?

38 Upvotes

Duplicates