Evolving big
microservice
architectures
Nikolay Stoitsev, Engineering Manager @ Uber Engineering
Dispatch API
A monolith?
Code was
consistently good
Easy to reuse code
Well tested
Hard to deploy
Pull Request
Pull Request
Pull Request
Pull Request
Pull Request
?
?
?
?
?
Pull Request
Pull Request
Pull Request
Pull Request
Pull Request
?
?
?
?
?
Unknown risk
Unknown priority
Low Risk
High Risk
High Risk
Med Risk
High Risk
Build
Low Risk
High Risk
High Risk
Med Risk
High Risk
Build
?
Low Risk
High Risk
High Risk
Med Risk
High Risk
Build
Low Risk / P0
High Risk / P1
High Risk / P0
Med Risk / P3
High Risk / P0
Build
Low Risk / P0
High Risk / P1
High Risk / P0
Med Risk / P3
High Risk / P0
Build CI / CD
Gradual rollout is important
Lesson learned:
A monolith can scale a lot, but...
Dispatch API
Dispatch API
UsersTrips
ReceiptsPayments
Dispatch API
Users
Trips
ReceiptsPayments
Dispatch API
UsersTrips
ReceiptsPayments
Dispatch API
UsersTrips
ReceiptsPayments
4000+ microservices
1K+ avg deploys a day
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
Sample architecture
We want to introduce Uber Elevate
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1 Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Task #3
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Task #3 Task #4
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Task #3 Task #4
Task #5Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Task #3 Task #4
Task #5 OKApache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Task #3 Task #4
Task #5 OK
Task #6
Apache
Kafka
Apache
Kafka
Apache
Kafka
How do we evolve
big microservice
architectures?
You can’t change what you can’t test
Staging environment?
Integration tests?
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Change
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Change
MOCK
MOCK
MOCK MOCK
Apache
Kafka
Apache
Kafka
Apache
Kafka
Multitenancy
Tenancy - set of data that is isolated
from the other sets of data
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Change
Apache
Kafka
Apache
Kafka
Apache
Kafka
Testing tenancy vs. Production tenancy
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Change
Test
Data
Test
Config
Test
Config
Test
Data
Apache
Kafka
Apache
Kafka
Apache
Kafka
Audit tenancy
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Audit
tenancy
traffic
Check
Test
Config
Test
Config
Test
Data
Apache
Kafka
Apache
Kafka
Apache
Kafka
Check Check
Check
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Task #1
OK
Task #2
Task #3 Task #4
Task #5 OKApache
Kafka
Apache
Kafka
Apache
Kafka
Platforms
Services are too concrete so it’s hard to
support new use cases
Services need to support abstraction
AWS is a good example
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Trips
Services
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Orders
Platform
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Orders
Platform
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Orders
Platform
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
Hard shift in mentality in the way you
design your services
Can you sell it outside of the company?
Tax Calc Payments Pricing
Tax Calc Payments Pricing
3.14159
Tax Calc Payments Pricing
3.14159 “3.14”
Tax Calc Payments Pricing
3.14159 “3.14” 314159
Common data
model
Data extensions = schema + payload
How to do it?
Schema service
Repo
Library
...
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Orders
Platform
Users
Payments
Services
Receipts
Apache
Kafka
Apache
Kafka
Apache
Kafka
… but there is still
business specific logic.
Dispatch
Pricing
Services
Tax
Calc
Vehicles
Orders
Platform
Users
Payments
Services
Receipts
Where to put it?
Business
logic
Apache
Kafka
Apache
Kafka
Apache
Kafka
No common understanding
of what should go where
How do we call code with business
logic, presentation logic, and SQL
queries all over the place?
We fix spaghetti code
with separation of concerns
Presentation
Logic
Data
Layered
architecture
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Why?
Common language
Clear separation of concerns
Consistent patterns
API and functionality discoverability
Engineering velocity
Users Vehicles
Order
Platform
Pricing
Tax
Calc
Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Generic
Specific
Users Vehicles
Order
Platform
Pricing
Tax
Calc
Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Breaks
everything
Breaks
specific thing
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
BackendPresentation
LoB
Biz Infra
Core
https://philcalcado.com/2018/09/24/services_layers.html
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Clay
Rocks
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
BackendPresentation
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
LoB
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Biz Infra
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Core
Clear API
protobuf
Apache Thrift
GraphQL
End result: Layered multitenant
architecture built with abstract
platforms and a common data model
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides
Web
Services
Mobile
Backend
Users Vehicles
Order
Platform
Pricing Tax Calc Payments Receipts
Rides Elevate
Web
Services
Mobile
Backend
Q&A
Feedback:
Proprietary © 2019 Uber Technologies, Inc. All rights reserved. No part of this document may be reproduced or utilized in any form or by any
means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval systems, without permission in
writing from Uber. This document is intended only for the use of the individual or entity to whom it is addressed and contains information that is
privileged, confidential or otherwise exempt from disclosure under applicable law. All recipients of this document are notified that the
information contained herein includes proprietary and confidential information of Uber, and recipient may not make use of, disseminate, or in any
way disclose this document or any of the enclosed information to any person other than employees of addressee to the extent necessary for
consultations with authorized personnel of Uber.

Evolving big microservice architectures