Saturday, 29 August 2026

UBER -System Design

 

🚕 Uber System Design – Class Notes

ఈ notes మీరు ఇచ్చిన transcript ఆధారంగా System Design interview preparation కోసం structuredగా తయారు చేశాను. ఈ lectureలో Uberని ఒక complex distributed systemగా ఎలా approach చేయాలి, requirements ఎలా identify చేయాలి, మరియు Consistency vs Availability ఎలా decide చేయాలి అనేదే ప్రధాన focus.


1. 🎯 Why Uber is a Complex System?

Uber simple taxi-booking application కాదు.

ఇందులో multiple difficult problems ఉన్నాయి:

                  UBER
                   |
      ┌────────────┼────────────┐
      ↓            ↓            ↓
   Maps         Location     Routing
      ↓            ↓            ↓
  Passenger      Driver      Matching
                   ↓
              ETA Estimation
                   ↓
             Dynamic Pricing

Main complexity areas

  1. Maps

  2. Location tracking

  3. Route optimization

  4. Two different user groups

    • Passengers

    • Drivers

  5. Driver-passenger matchmaking

  6. ETA / Time-to-arrival estimation

  7. Dynamic pricing

అందువల్ల Uber system designలో multiple subsystems గురించి ఆలోచించాలి.


2. 👥 Two Different User Groups

Uberలో two major actors:

Passenger                  Driver
    |                         |
    | Request ride            | Accept ride
    |                         |
    └──────────┬──────────────┘
               ↓
          Matchmaking

Passenger side

  • Request ride

  • See available drivers

  • Track ride

  • See ETA

  • See current location

Driver side

  • Receive ride request

  • Accept request

  • Navigate to passenger

  • Update location

  • Track ride progress


3. 🧠 First Three Core Assumptions

System Design interview ప్రారంభంలో systemని classify చేయడానికి మూడు questions:

1. Read-heavy or Write-heavy?

2. Distributed or Single Server?

3. Consistency or Availability?

Uberలో వీటికి straightforward answer ఇవ్వడం కొంచెం difficult because different parts have different characteristics.


4. ✍️ Read vs Write Heavy

Uber ఒక matchmaking platform.

Passenger continuously requests rides.

Drivers కూడా continuously interact చేస్తారు:

Passenger
   ↓
Ride Request
   ↓
Matching

Driver
   ↓
Read / Accept Request
   ↓
Matching

అందువల్ల:

Uberలో reads మరియు writes రెండూ చాలా ఎక్కువగా ఉంటాయి.

Transcript specifically Uberని easily read-heavy లేదా write-heavyగా classify చేయడం difficult అని చెబుతుంది.


5. 🌐 Distributed System

ఇది clear:

Uber is a distributed system.

ఎందుకంటే:

  • Huge number of users

  • Huge number of drivers

  • Real-time location updates

  • Geographically distributed operation

  • Matching

  • Maps

  • Payments

  • Multiple services

అన్నీ large scaleలో operate అవుతాయి.


6. ⚖️ Consistency vs Availability

ఇది interviewలో చాలా important.

ఒక network partition జరిగిందనుకోండి:

Service A  ✕  Service B
       Network Partition

అప్పుడు systemకి question:

Should we prefer Consistency or Availability?

Uberలో answer:

Depends on the subsystem.


7. 💳 Payment / Ride Management → Consistency

User action paymentకి సంబంధించినదైతే:

User
 ↓
Payment
 ↓
Ride Management

ఇక్కడ consistency చాలా important.

ఎందుకంటే inconsistent data వల్ల:

Double booking
      OR
No booking
      OR
Incorrect payment

జరగవచ్చు.

కాబట్టి:

Payment + Ride Management + Matchmaking → Consistency preferred


8. 🗺️ Map / Informational Features → Availability

ఇప్పుడు mapలో nearby taxis location చూపిస్తున్నామని అనుకుందాం.

Network issue వల్ల latest location update రాకపోయినా:

Old location
     ↓
Show user

చేయడం sometimes better.

ఎందుకంటే:

Slightly outdated information is better than no information.

అందువల్ల:

Map / informational features → Availability preferred


9. ⭐ Key Interview Insight

Uber మొత్తం systemకి ఒకే CAP preference apply చేయకూడదు.

Instead:

                UBER
                  |
        ┌─────────┴─────────┐
        ↓                   ↓
 Critical Operations    Informational
        ↓                   ↓
  Consistency           Availability
        ↓                   ↓
 Payment               Maps
 Ride Management       Location display
 Matchmaking           Status updates

Golden Rule

Money / state-changing operations → Consistency

Informational / real-time display → Availability


10. 🎯 Functional Requirements

Transcriptలో core priority:

Matchmaking should work.

అంటే passengerకి suitable driverని identify చేసి ride match చేయాలి.


11. Core Feature – Match Passenger with Driver

Basic flow:

Passenger
   |
   | Request Ride
   ↓
Matching Service
   |
   | Find nearby suitable driver
   ↓
Driver
   |
   | Accept
   ↓
Ride Created

ఇది Uber యొక్క central functionality.


12. 🚗 Driver-side Request Handling

Driverకి ride request వస్తుంది.

Matching Service
       ↓
Driver App
       ↓
Accept / Reject
       ↓
Ride Management

Driver request handling కూడా core functionality.


13. 📍 Track Ride Progression

Ride match అయిన తర్వాత:

Ride Created
     ↓
Driver travelling to pickup
     ↓
Passenger picked up
     ↓
Trip in progress
     ↓
Destination reached
     ↓
Ride completed

Passenger మరియు driver ఇద్దరూ తమ devicesలో ride progression చూడాలి.


14. 📡 Real-Time Location

Uberలో real-time location చాలా important.

Passenger:

"Driver ఎక్కడ ఉన్నాడు?"

Driver:

"Passenger pickup location ఎక్కడ?"

అందువల్ల continuous location updates అవసరం.

Driver App
   ↓
GPS Location
   ↓
Location Service
   ↓
Passenger App

15. 🚕 See Available Drivers

Passenger ride request చేయడానికి ముందు nearby drivers available ఉన్నారా అని చూడవచ్చు.

Passenger
    ↓
Map
    ↓
Nearby Available Drivers

ఇది user experienceని improve చేస్తుంది.


16. 📋 Functional Requirements Summary

Core

  1. Match passengers with drivers

  2. Handle driver ride requests

Supporting

  1. Track ride progression

  2. Real-time location

  3. See available drivers


17. 🚀 Non-Functional Requirements

Transcriptలో మూడు major NFRs:

       Uber NFRs
           |
    ┌──────┼──────┐
    ↓      ↓      ↓
Availability Scalability Low Latency

18. 🟢 High Availability

Uber users mobility కోసం applicationపై depend అవుతారు.

Imagine:

Airportకి వెళ్లాలి
      ↓
Uber unavailable
      ↓
Miss flight

అందువల్ల:

Uber should be highly available.

Downtime user trustని severely affect చేస్తుంది.


19. 📈 Scalability

Peak traffic predictable patternsలో వస్తుంది.

Examples:

  • Football matches

  • Concerts

  • Friday nights

  • Major social events

Example:

Normal:
████

Concert ends:
████████████████████████

Sudden spike వచ్చినా system:

  • More ride requests

  • More driver interactions

  • More location updates

handle చేయాలి.


20. ⚡ Low Latency

Uberలో delay చాలా visible.

Userకి:

“Driver ఇంకా ఎక్కడ ఉన్నాడు?”

అనే questionకి current answer కావాలి.

Important real-time information:

  • Driver location

  • ETA

  • Ride status

అందువల్ల:

Low latency is critical for user trust and safety.


21. 🎯 Non-Functional Requirements Summary

RequirementWhy important?
High AvailabilityUsers depend on Uber for mobility
ScalabilityEvents/Friday nights create traffic spikes
Low LatencyReal-time location & ETA

22. 🔍 Scope Clarification

System Design interviewలో వెంటనే architecture draw చేయకూడదు.

ముందుగా interviewerని scope గురించి questions అడగాలి.

Transcriptలో suggested questions:

Q1. How many daily active users?

DAU = ?

Q2. How many drivers?

Drivers = ?

Q3. Driver/passenger interactions per day?

ఇది request volume estimate చేయడానికి ఉపయోగపడుతుంది.


23. 📊 Peak Load

Ask:

Social events సమయంలో peak traffic ఎంత multiple అవుతుంది?

Example:

Normal traffic = 1X

Concert = 5X
Football match = 10X

Exact numbers transcriptలో ఇవ్వలేదు.

Interviewలో interviewer నుంచి తెలుసుకోవాలి.


24. 📖 Read / Write Ratio

Ask:

What is the read/write ratio?

ఎందుకంటే architecture decisionsపై impact ఉంటుంది.

Read-heavy
    ↓
Caching / Read replicas

Write-heavy
    ↓
Write scaling / partitioning

25. 🗄️ Database Replication

Another scope question:

Is database replication used? If yes, what is the replication factor?

ఇది:

  • Availability

  • Read scalability

  • Fault tolerance

వంటి design decisionsకి important.


26. 🗺️ Two Important Technologies

Transcript చివర్లో Uber గురించి deeper understanding కోసం రెండు technologies specifically recommend చేసింది:

1. Quad Trees

2. Geohashing

ఇవి primarily geospatial/location-based searching problemని reason చేయడానికి useful concepts.


27. 🌳 Quad Tree – Basic Idea

Large geographical areaని recursively smaller regionsగా divide చేయడం.

              World
        ┌──────┬──────┐
        │      │      │
        ├──────┼──────┤
        │      │      │
        └──────┴──────┘

మళ్లీ each regionని divide చేయవచ్చు.

Use case:

Nearby drivers efficiently locate చేయడం.


28. 🧭 Geohashing – Basic Idea

Latitude + Longitudeని ఒక spatial identifier/stringగా encode చేసి nearby locationsని efficiently group/search చేయడానికి ఉపయోగించే technique.

Concept:

Latitude + Longitude
        ↓
    Geohash
        ↓
Spatial region
        ↓
Nearby drivers

ఇది location indexingలో useful.

ఈ transcriptలో Quad Tree మరియు Geohashing గురించి detailed implementation లేదు; వాటిని further study చేయాల్సిన technologiesగా మాత్రమే సూచించింది.


29. 🏗️ High-Level Uber Architecture

Transcript requirementsని architectureకి map చేస్తే:

                    ┌──────────────┐
                    │ Passenger App│
                    └──────┬───────┘
                           │
                           ↓
                    API / Gateway
                           │
              ┌────────────┼────────────┐
              ↓            ↓            ↓
         Matching      Ride Mgmt    Location
          Service       Service      Service
              │            │            │
              ↓            ↓            ↓
           Drivers      Ride DB     Geo Index
              │
              ↓
        Driver App

ఇది conceptual architecture మాత్రమే; transcript exact component architecture provide చేయలేదు.


30. 🔄 Uber Core Flow

Step 1 – Passenger requests ride

Passenger
   ↓
"Request Uber"

Step 2 – Matching

Matching Service
   ↓
Find nearby drivers
   ↓
Select suitable driver

Step 3 – Driver accepts

Driver
   ↓
Accept

Step 4 – Ride created

Ride Management
   ↓
Ride State

Step 5 – Location tracking

Driver GPS
   ↓
Location Service
   ↓
Passenger

Step 6 – Ride completion

Destination
   ↓
Ride completed
   ↓
Payment

Payment exact architecture transcriptలో explain చేయలేదు, కానీ payment-related operations consistencyకి priority ఇవ్వాలని lecture చెబుతుంది.


🧠 31. Most Important Interview Concept

Uberని design చేసేటప్పుడు:

Don't treat the entire system as one consistency model.

Different operationsకి different priorities.

                 UBER
                  |
       ┌──────────┴──────────┐
       ↓                     ↓
  Critical State         Informational
       ↓                     ↓
 Consistency             Availability
       ↓                     ↓
Payment                  Map
Ride state               Location display
Matching                 Status

ఇది ఈ lectureలో అత్యంత important system-design lesson.


🎯 Interview Answer – 1 Minute

“Uber is a large-scale distributed matchmaking system with two primary user groups: passengers and drivers. Its core functionality is matching passengers with drivers and managing the ride lifecycle. Important supporting features include real-time location, ride progression, ETA, and available-driver discovery. The system needs high availability, scalability for event-driven traffic spikes, and low latency for real-time location and ETA. Consistency requirements differ by subsystem: payment, ride management and matchmaking should prioritize consistency because incorrect state can cause double booking or incorrect transactions, while informational features such as map/location display can prioritize availability, where slightly stale information is preferable to no information. For geospatial matching, important technologies to study are Quad Trees and Geohashing.”


🔥 Final Interview Cheat Sheet

                 UBER
                  |
       ┌──────────┼───────────┐
       ↓          ↓           ↓
 Passenger      Driver     Matching
       |          |           |
       └──────────┼───────────┘
                  ↓
             Ride Management
                  |
        ┌─────────┼─────────┐
        ↓         ↓         ↓
     Location    ETA      Pricing
        |
        ↓
   Geo Search
        |
   ┌────┴────┐
   ↓         ↓
Quad Tree  Geohash

⭐ Remember these 7 points

1. Uber = Distributed System

2. Two actors = Passenger + Driver

3. Core = Driver-Passenger Matching

4. NFR = Availability + Scalability + Low Latency

5. Payment/Ride/Matching = Consistency

6. Maps/Informational data = Availability

7. Geospatial matching = Quad Tree + Geohashing

🧩 System Design interview sequence

Requirements → Scope/Scale → Consistency vs Availability → High-level architecture → Matching → Geospatial indexing → Location updates → Ride lifecycle → Scaling & failure handling

No comments:

Post a Comment