Skip to content
← All concepts

Scale & distribution

Geospatial indexing

Bucket locations into cells so 'what's near me' becomes a quick lookup.

Ride-hailing and delivery need nearby drivers or restaurants instantly. The map is divided into cells (Geohash, S2, H3); each location is stored under its cell, and a nearby search reads the cell and its neighbours.

See it in action

Play with the idea, then follow it through a real architecture.

Try it: move the rider

The city is split into cells. Click a cell to move the rider; matching only looks in that cell and its neighbours.

Searched 9 of 48 cells and checked 5 of 18 drivers. Those few candidates are then ranked by real road ETA.

Laying out diagram…

1/4A driver's position arrives.

Driver app
— Sends GPS every 4 s
Location service
— Moves drivers between cells
Geo index
— cell id → drivers
Rider app
— Requests a ride
Matching
— Searches the rider's cell and neighbours

How it works

  • Live positions in memory keyed by cell; updated every few seconds.
  • Smaller cells in dense cities, larger elsewhere.
  • Rank candidates by road ETA, not straight-line distance.

Trade-offs

  • Cell boundaries mean you must also search neighbouring cells.
  • Hot cells in busy areas need extra shards.

Seen in

Components involved

Related concepts