educative.io

Educative

Location updates from 1million drivers

What is the mechanism used to receive updates from 1million drivers every 3 seconds? A very lightweight API that simply updates the hashtable and so can handle a load of 1million requests every 3 seconds?

1 Like

@Rayan_A_Almeida
Two approaches:
-Via socket
-Via a lightweight REST API

I think we should go with a simple REST API for writing location to Driver Location Server.

Because it’s simple.

1 M drivers every 3 sec means 333333 Request per second.
Payload will be 8 bytes(ID) + 8 bytes ( lat ) + 8 bytes ( lon ) + 8 bytes ( timestamp ) = 32 bytes.
so we are transferring 10MB of data approximately every second.
Given that there is no immediate need to read latest locations, we can write these locations in very fast distributed cache.
With help of LB in front of Driver location servers, we can distribute load effectively.

However, we need to transfer these locations to consumer app where he can see the live location of driver. For that i think a socket connection can make sense.