Design Uber taxi service

Claim

  • Serving the global transportation market
  • Large-scale real-time scheduling
  • Back-end design

Architecture

uber architecture

Why micro-services?

Conway's LawSystem structure of the software will correspond to the organizational structure.

monomerservice Micro Services
When the team size and the code base is small, productivity ✅ high ❌ low
When a large team size and code libraries, productivity ❌ low ✅ high (Conway's Law)
Requirements for quality of the project High ❌ (lack of capacity developers can easily undermine the whole system) ✅ low (runtime isolated)
dependency upgrade ✅ fast (centralized management) ❌ slow
Multi-tenant support / production -staging state of isolation ✅ easy ❌ difficult (each service must be 1) either set up a staging environment to connect to other services in the staging state 2) or request context, and data storage across multi-tenant support)
Debuggability, assuming the same module, parameters, log ❌ low ✅ high (if there is a distributed tracing)
delay ✅ low (local) ❌ high (remote)
DevOps costs ✅ low (build high tooling costs) ❌ high (capacity planning difficult)

Monomer combinationCode libraryAnd micro-services can take advantage of the strengths of both at the same time.

Scheduling Service

  • Provide a consistent hash address by geohash
  • Transient data in memory, there is no need to copy. (CAP: AP than CP)
  • Or slice using a single thread lock to prevent double schedule

Payment Services

The key is to have asynchronous designBecause ACID transaction payment system across multiple systems typically have very long delays.

User Profile service and travel records service

  • Use caching to reduce latency
  • With the 1) support more countries and regions, 2) user role (driver, rider, restaurateurs, diners, etc.) gradually increased, to provide users file services for these users also faces enormous challenges.

Push notification service

  • Apple's push notification service (unreliable)
  • Google Cloud Messaging Services GCM (it can detect whether the successful delivery) or
  • SMS services are usually more reliable

This article first appeared in Silicon Valley io

Guess you like

Origin juejin.im/post/5dc1725c6fb9a04ab320289b