Positions: a firehose kept out of the trip store
Each driver app sends a small message on its socket every 4 seconds to a connection server, which hands it to the location service. That service overwrites the driver’s entry in the city’s in-memory position store, and moves free drivers between cells so the search can go straight to an area. Nothing here touches the trip database. The same stream goes to a log for history and analytics, off the matching path.
Diagram as text
Components: Free drivers by cell (Cache); Driver app (Client); Connection server (API gateway); Location service (Service); Latest position per driver (Cache); Position log (Queue); History (Object store). Connections: Driver app → Connection server (position + seq); Connection server → Location service (position); Location service → Latest position per driver (overwrite if newer); Location service → Free drivers by cell (move if free); Location service → Position log (copy), asynchronous; Position log → History (analytics), asynchronous.
Read:Learn: Write-heavyLearn: Storage choice justification
Check yourself
The position store loses its last few seconds in a crash. What breaks?
Show answerHide answer
Very little: every online driver sends a new position within seconds, so the store refills itself. Losing a trip would be a different matter, which is why trips live elsewhere.