Uber/Lyft/Ola system design

Points to remember:

  1. Uber calculates the ETA by taking into consideration several factors like turns, signals, stops, traffic roads. 
  2. Uber has a backup data center that will be used in case of DC failure. But Uber never copies the data in the backup DC. 

Dispatch service:

  1. Use Google's S2 service to find the car within a specific radius. 
  2. Google S2 will take a region and converts it into small cells of 1x1m so it will be easier to manage it. 
  3. Uses consistent hashing(Ring structure) to distribute the work. And it makes a server to server call. 
  4. Uses gossip protocol so each service knows the responsibilities of each server. 
    1. Advantages: 
      1. Easy add/remove the server. 
      2. Balances out the load. 
Core components:
  1. Load Balancer
  2. Then the request is sent to Kafka REST service
  3. Then the request is forwarded to Kafka
  4. Kafka will send the request to application server and no-sql/sql DBs. 

WorkFlows:
  1. Users makes the request to LB -> Web-socket -> Application Server
  2. Demand module within service contacts gives the cell to Supply module. 
  3. Supply module then makes the call to Google S2 library to find the cars within the radius of x of that specific cell. 
  4. Servers will communicate amongst each other and collect their ETA then provide it to the Supply module that in turn will communicate it to the demand module. 
  5. If new cities are added then servers will be added with their cell data. 
Analytics Workflow:
  1. Take data from NoSQL DBs and dump it into Hadoop. 
  2. Use tools like Hive and Pig to get desired data. 

Technologies:
  1. Supply/Demand components are written in Node.js as they are useful in async messaging and its event driven framework.
  2. No-Sql DBs like Cassandra to help with:
    1. Scalability
    2. No downtime
  3. Hadoop analytics tools to build analysis data.  
  4. Spark/Storm framework to do realtime streaming distributed analysis to figure out trending things happening. 
  5. Log stash/Kibana to do log elastic search. Dashboards can be built to check systems health. 
Sources:

No comments:

Post a Comment

NoSQL

This one is reviewed but I need to delete its copy from hubpages or somewhere NoSQL Data models: key-value  Aggregate model.  key or i...