Skip to content

Featured article for the topic Design Uber · picked by the needcode team

Design Uber: geohashes, matching and surge pricing

Riya MenonFeatured AuthorPosted · 1 min read

Uber's core loop is simple to say and hard to build: find the nearest available drivers to a rider, fast, while millions of drivers move every few seconds.

Location updates#

Drivers send their position every 4 seconds. That is a write-heavy stream, so keep it in memory: a geospatial index keyed by geohash cell, updated in place.

Finding nearby drivers#

A geohash turns a latitude and longitude into a string where shared prefixes mean nearby cells. To find drivers near a rider, look up the rider's cell and its eight neighbours.

Surge pricing#

Surge is a ratio of open requests to available drivers per cell, smoothed over a few minutes so prices don't flicker.

Text by Riya Menon, licensed under CC BY-SA 4.0. You may share and adapt it with credit to the author, under the same licence.

Other approaches to Design Uber

Submit your approach

No other approaches yet. Think you can explain it differently? Write one.

Comments

Loading comments…