Coconote
AI notes
AI voice & video notes
Try for free
🚕
System Design of Uber
Jun 22, 2024
System Design of Uber
Introduction
Presenter
: Anshul Sadariya, Software Engineer 3 at Google
Previous system design videos: Twitter, Tinder
Focus on understanding large-scale products
Video topic: System design for Uber (applicable to similar services like Ola, Lyft, Kareem)
Plug: Scalar's free master classes by industry experts
Customer User Journeys (CUJs)
User Types
: Normal user (rider) and driver
Driver CUJs
:
Create profile
Show availability
Accept or reject rides
Navigate to pickup location
Start the ride
Navigate to drop location
End the ride
Accept payment and optionally rate the rider
Rider CUJs
:
Create profile
See nearby cabs
Add start/end location
Show ETA and approximate price
Book cab
Make payment and optionally rate the driver
See past trips and payment history
Check current trip status
Functional Requirements
Each CUJ translates into a functional requirement of the app
Mapping CUJs to functional requirements, e.g., showing ETA or booking a cab
Non-Functional Requirements
Minimal latency
: Fast response times
High availability
: Service should rarely, if ever, go down
Durability
: Data should persist and not be lost
Scalability
: Able to handle peak times and expansion to new locations
Consistency
: Strongly consistent where needed (e.g., active rides), eventually consistent where acceptable (e.g., past payments)
Operational Scale
Metrics
:
100 million MAU (monthly active users)
10 million daily rides
1 million daily active drivers
100 QPS (queries per second)
Considerations:
Handling high QPS for ride requests
Efficiently finding and pinging available drivers
Optimization Techniques
:
Geohashing, Quadtree, and Google S2 Library for managing lat/long data
Distributed Hash Ring for managing server responsibilities
Major Technical Concepts
Communication
HTTP Requests
: Synchronous
WebSocket Servers
: Asynchronous, peer-to-peer connection
Mapping and Location
Map Service
:
Converts lat/long to chunk ID
Computes ETA
Determines pricing
Location Service
:
Stores latest lat/long data
Historical location data for analytics and machine learning
Uses Redis for fast data retrieval
Cassandra cluster for historical data
Finding Nearby Cabs
Cab Finder Service
(or Dispatch Service): Matches riders with drivers based on proximity
Consistent Hashing and Gossip Protocol
: For managing server responsibilities dynamically
Data Management and Analysis
Trip Service
:
Tracks trip states (accepted, started, ended)
Stores active and inactive trip data
Uses SQL database for active trips and Cassandra for historical trips
Payment Service
:
Calculates fare based on trip data
Integrates with payment gateways (Stripe, Razorpay)
Profile Service
: Manages CRUD operations for user and driver profiles
Additional Analytics
:
Preferred access points based on aggregate location data
Machine learning for fraud detection and driver profiling
Use of Kafka queues for real-time data processing
Additional Concepts
ELK Stack
: For log analysis and visualization
Conclusion
Covered major technical concepts and services required to build an Uber-like application
Emphasized understanding of functional and non-functional requirements
Discussed real-time data processing and machine learning integrations
Encouragement to check out scalable and insightful content
📄
Full transcript