Make money doing the work you believe in

How do you design “Find Nearby Rides” in Uber?

.

.

The figure shows a simple breakdown of how Redis can be used for this:

  • Geohash: A 52-bit integer created by interleaving the bits of latitude and longitude coordinates.

  • Sorted Sets: Redis stores driver IDs with geohashes as scores, enabling efficient location-based sorting.

  • Driver Location Update:

    • Redis command GEOADD drivers:current_location updates driver locations using latitude, longitude, and driver ID.

    • Geohashes are stored in a sorted set for quick lookup.

  • Ride Request:

    • GEOSEARCH queries Redis for nearby drivers within a given radius from the user’s location.

    • Redis returns driver IDs and additional info like availability or ETA from other data stores.

——

Read complete deep dive on “How to use Redis in system design interviews“ at read.systemdesignbluepr… to learn about more use cases of Redis.

Oct 17, 2024
at
2:28 PM
Relevant people

Log in or sign up

Join the most interesting and insightful discussions.