Friday, October 26, 2018

System design Uber



Uber architecture relies on supply and demand.

  • Demand is for the user and supply is provided by the car
  • It uses a flat map from google to generate unique cell across the world regions
  • Each cell would have a  unique id
  • It would draw a circle that would have one or more cells as shown below



  • Once they have the circle the app would find all the vehicles that are available in that circle
  • Every 4 secs supplier and demander information is sent to the server
  • Each block are services by its own

LOCATION
  The app knows the exact drop and pick up stop based on previous experience

WAF:
     Filters all the incoming ip

LB:
     It is the load balanceR

HTTP Rest
    This is built using node. This is responsible for receiving and sending data from the server and back to the user

KAFKA REST API
    This is responsible for receiving all the traffic sent by the supply and demand

WEB SOCKETS node
    This is responsible for constantly receiving the state of the supply and demand

DISCO
    This is built on consistent hashing of gps location and server in disco is selected
     Ex each region would be given particular loads from different cells

RDBMS
    It has RDBMS system that used to store relational data

NOSQL region
   Different schema-less data is stored across different nodes. They use MySQL, however we can use  Cassandra or any other sources for doing the same

HDFS FILE SYSTEM
   Data is stored here for analytical purposes

 ML FRAUD DETECTION
   This server runs machine learning algorithm to check fraud detection by the user and the driver

MAP CREATION AND ETA CALCULATION
   It uses google maps, location and existing previous rides to calculate ETA for a given ride

PRICING AND SURGING
   This is responsible for pricing and surging for the app

SPARK AND STORM
   This is used for batch and stream processing

ANALYTICS
   This is done using jupyter and ELK stack

LOGS AND SERVICES
   The logs are loaded from all the services using kafka. These are fed to elastic search and kabana for analytics

BACKUP CENTER

  •  Uber has its own backup data center.
  •  In case of failure data center is switched
  •  It is the replica, of the existing system, however it would not have any data
  •  Data would be copied from all the suppliers app and loaded to the new data center
  •  This happens asynchronously without rider and the driver noticing the changes 









No comments:

Post a Comment