r/howdidtheycodeit • u/R_Olivaw_Daneel ProProgrammer • Sep 30 '21
How does Uber/Lyft continuously track drivers and their locations relative to the user searching for a ride?
34
Upvotes
r/howdidtheycodeit • u/R_Olivaw_Daneel ProProgrammer • Sep 30 '21
View all comments
Show parent comment
2
u/spacemudd Oct 01 '21 edited Oct 02 '21
Yes, a continous connection! A small instance (e.g. $5 from DigitalOcean) can be capable of handling thousands of clients connected without an issue. I don't have benchmarks at hand though you can check it out online.
As long as there are scalable webservers infront of the web-socket instance(s), there will very little issue.
If I were to design something like Uber, I'd have a web-socket server designated for each size of blocks (like, 50km x 50km blocks or for each city) that the drivers will connect to. (EDIT - Uber splits Earth into little tiny hexagonals in grids https://eng.uber.com/h3/)
I'd have scalable front-servers that will redirect traffic to the appropriate web-socket server for each region depending where the driver is.