0

I understand Uber(or any other cab service) server receives the user coordinates through app. say I book the cab at 10 am. But how does uber know which cabs which is vacant and nearest to user coordinate , then notify that driver

Say i am at location X of city new york. How does uber server will know what are the cabs near to location X. Does all cabs sending their coordinates to server at regular interval of time which server maintains somewhere in memory and then when user request comes, it selects the cab which is nearest or is it altogether different algorithm ?

I believe uber use spherical geometry services per https://www.quora.com/What-is-Ubers-server-architecture. But I am not sure how it helps in above ?

  • See Uber Geolocation. – Robert Harvey Jun 27 '17 at 3:49
  • Yeah I have already scene that But mine question is still un-answered there too – user3198603 Jun 27 '17 at 3:54
  • are you asking specifically how uber does it? – Ewan Jun 27 '17 at 5:02
  • Not specifically Uber but any similar Cab service ? – user3198603 Jun 29 '17 at 2:37
1

Each cab has a device which sends its location and driver availablity to a central server.

This allows the central server to work out the closest driver, but also make a decision based on driver rating and other commercial factors.

  • Each cab has a device which sends its location and driver availablity to a central server. Actually my question is on this part. Say Uber has 1 million cabs . Does each cab can sends its location after some seconds which uber(or any other large scale cab service) keeps in memory ? If yes i believe they must be caching the data cache clusters something like memcache based on longitude and latitude. Now as soon as book request comes up, it will pick right cache node based on longitude and latitude and then send the push notification to right cab ? – user3198603 Jun 29 '17 at 2:47
  • doing a spherical surface distance calc on a million database rows isn't a particularly expensive operation. Finding the nearest cab is the easy part – Ewan Jun 29 '17 at 7:07
  • But still keeping in memory will be much faster than db . An disadvantage you see apart from cost ? – user3198603 Jun 29 '17 at 14:16
  • its a common misconception that memory is faster than a db. – Ewan Jun 29 '17 at 16:18
  • 1
    a: because a db will cache results to memory in any case and b: because indexing means you will read less data – Ewan Jul 1 '17 at 7:15
2

Each diver has its status in the central database. To get the nearest one probably they're using approximation so they are taking latitude / longitude of the user, calculate rectangular area on the map and pick the cars within it. Then, after filtering they're able to calculate real distance using road map, which is much more resource consuming.

That's why there's probably at least one or several stages of filtering before real calculation is taking place.

  • Each diver has its status in the central databas .Actually my question is on this part only. Say Uber has 1 million cabs . Does each cab can sends its location after some seconds which uber(or any other large scale cab service) keeps in memory ? If yes i believe they must be caching the data cache clusters something like memcache based on longitude and latitude. Now as soon as book request comes up, it will pick right cache node based on longitude and latitude and then send the push notification to right cab ? – user3198603 Jun 29 '17 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.