-
Drivers
- Drivers need to constantly update their location, possibly every 3 seconds.
- They need to notify server that they are ready to pick up a passenger.
-
Customers
- Can see the near by drivers.
- Request a ride.
The first driver to accept the ride gets that customer.
For now let's have multiple drivers and 1 customer.
UpdateLocation(Driver Object, latitude, longitude, availability)
RequestRide(Customer Object, srcLat, srcLong, destLat, destLong)
srcLat = Source Latitude
srcLong = Source Longitude
destLat = Destination Latitude
destLong = Destination Longitude
How much space would our driver HashTable need ?
Currently my hash table stores the driver id and new latitude and longitude.
So if my driver id is let's say 3bytes and latitude and longitude are 8bytes each then total space for 1 driver would be 3+8+8 = 19bytes.
How much bandwidth would we require to update the hash table ?
We are getting 19 bytes every 3 seconds per driver.
In both cases I haven't mentioned what would be the total space/bandwidth, I have only mentioned for 1 driver. You take this 1 driver and multiply with what ever number the interviewer gives you. Based on this new number you can say ok may be I require more server or may be my current server can handle more requests.
Do we repartition the grid every time the number of drivers grow and the grid reaches it's capacity?
We can have some sort of cushioning, like we can allow an extra 10% growth before partitioning the grid.
What if the notification server fails ?
Hash Table cash for drivers can grow a lot in size, how would you tackle that ?