Monday 4 January 2016

Design UberX

1. Scenarios:

Case 1: A driver starts its service and drive around.
             The driver should see his/her locations moving on map.
Case 2: A driver accepts/denies a trip request.
Case 3: A driver takes a rider to the destination.
             The fee should be updated frequently.
Case 4: A driver dhows the fee and print the receipt for the rider.

Case 5: A rider searches nearby cabs.
Case 6: A rider posts a request and read the response.
Case 7: A rider find the cab.
Case 8: A rider takes the cab to the destination.
Case 9: A rider pay the fee and get the receipt.

2. Constraints:

Assumed number of full-time Drivers: 1 Million
Assumed number of part-time Drivers: 1 Million
Assumed number of Drivers during a peak hour: 1 Million * 80% + 1 Million * 20% = 1 Million

Assumed Average Trip Length: 20 minutes
Assumed Number of Trips during Peak hour: 2 Million trips

Assumed Peak Trips in a second: 2 Million trips / 3600 * 2 = 1111 trip/second

Assumed Memory Requirements: 2 Million * 20 / 60 * 1 Kb = 667 Mb
Assumed Traffic Requirements: 2 Million * 20 / 60 * 10 Kb/s = 6.67 Gb/s

Assumed Data Storage Requirements Per peak hour: 2 Million trips * 1kb = 2 Gb

3. Service:
  • 1. UberX Monitoring Service (both Demand and Supply)
  • 2. Application Service
  • 3. Dispatch Service
  • 4. Business Logic Service (Fee & Receipt)
  • 5. Payment Service (3th Party)
  • 6. User Service
4. Data

Demand and Supply (including gps updating)
No SQL

Business Logic Service
No SQL

Dispatch
No SQL

User Service
Database (MySQL)

Payment Histrory
Database (MySQL)

5. All Together


6. Key Algorithms / Methods
  • Dispatching Algorithm  (Minimizing Estimated Arrive Time)
  • Arrive Time Estimation Algorithm


No comments:

Post a Comment