KEMBAR78
Lessons Learned on Uber's Journey into Microservices | PDF
Uber’s Journey into
Microservices
Emily Reinhold, Software Engineer, Uber
JUNE 15, 2016
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
https://www.infoq.com/presentations/
uber-darwin
Presented at QCon New York
www.qconnewyork.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Our Monolith
Background
‣“API”
‣Started January 2011
Fun Facts
Lines of Code over Time
0K
75K
150K
225K
300K
2011 2012 2013 2014 2015 2016
Unique Authors over Time
0
150
300
450
600
2011 2012 2013 2014 2015 2016
Start of
migration.
Yay!
API Trends
‣“API”
‣Started January 2011
‣Access to core data models
Fun Facts
Core Data Models
Users Trips Payments
Products Cities Documents
Exchange
Rates
Vehicles Promos
The Uber Monolith
‣Postgresql
‣Python 2.7
‣HTTP/JSON
‣uWSGI
Technical Details
Request Flow
Matching
Service
haproxy API box nginx uWSGI
process
Postgres
Downstream
Services
Third Parties
API
‣Minimal overhead for cross-
domain features
Benefits
“Cross Domain”
Users Trips Payments
Products Cities Documents
Exchange
Rates
Vehicles Promos
The Uber Monolith
‣Minimal overhead for cross-
domain features
‣Reuse code across domains
‣Broad, extensible interface
Benefits
‣Honks
‣Halloween 2014
‣Postgresql Master Failure
Historic Outages
Image courtesy of Anita Hart. Licensed under CC-BY-SA 2.0.
https://flic.kr/p/8PG15b
Postgresql Master Failure
‣Honks
‣Halloween 2014
‣Postgresql Master Failure
‣Kafka Outage
Historic Outages
Kafka Outage
‣Deploy burden
‣Single Postgres Master
Technical Bottlenecks
Image courtesy of Paul Schadler. Licensed under CC-BY 2.0.
https://flic.kr/p/aDoGkP
‣Rapid hiring
‣Slow test suite
‣Toe stepping, merge conflicts
Developability
‣Growth of business
‣Growth of features
‣Growth of organization
Scalability 3 Ways
In Microservices
Our Future
‣Horizontally scalable
Benefits
Scalability
Trips Users Promos
‣Horizontally scalable
‣Improved onboarding
‣Clear ownership
Benefits
Ownership
No hiding!
You’re on call!
‣Horizontally scalable
‣Improved onboarding
‣Clear ownership
‣Failure isolation
Benefits
Granular Failures
Old Way
API
client
show
Payments
Promos
User tags
Edge Service
New Way
Edge Service
Payments Promos Users
?
Lessons Learned
‣Drastically changing tech
stack
Limit Scope
Tech Stack
That’s
me!
eng.uber.com/building-tincup/
Data Migration
1. Develop new
schema
2. Implement
converter
3. Dual write 4. Backfill
6. Move read
queries
5. Validation
?
7. Remove old
writes
‣Drastically changing tech
stack
‣Infrastructure not ready
‣ Understaffed
‣ Lacked tooling
Limit Scope
Things Happen
Image courtesy of Kim Scarborough. Licensed under CC-BY-SA 2.0.
https://flic.kr/p/23HUAK
‣Drastically changing tech
stack
‣Infrastructure not ready
‣ Understaffed
‣ Lacked tooling
‣Understanding timelines
Limit Scope
‣Monolith’s consumers
directly impacted
Aligning with Consumers
Consumers
API
Pricing
Matching
Signup
Exchange rates
Cities
Users
Trips
Trips
Exchange
Rates
Cities
Users
‣Monolith’s consumers directly impacted
‣Importance of migrating not well
communicated
‣Constant interruption
Aligning with Consumers
‣For service developers and
migrating consumers
‣Tool to split up request
Build Tools Initially
Request Splitter
API
Cities
Currencies
Users
Trips
Old Way
requesting trip
info, with
relationships
on user,
currency, city
New Way
API
Cities
Currencies
Users
Trips
Tool
requesting trip
info, with
relationships
on user,
currency, city
request user
request city
request currency
request trip
‣For service developers and migrating
consumers
‣Tool to split up request
‣Tool to validate new response
‣Tool to gain visibility into consumers
Build Tools Initially
‣Most difficult aspect of migration
‣Silently call new system
Consumer Migration Tips
Silent Swap
API
Matching
Signup
Exchange ratesCities
Users Trips
Users
‣Most difficult aspect of migration
‣Silently call new system
‣Most successful migration kept
interface the same
Consumer Migration Tips
‣Tendency to avoid changes
‣Tackling core (User) directly
required refactor
Love your Monolith
‣Likely to impact other teams
‣Teams shift focus
Migration Blockers
Migration Successes
‣Shared accomplishment
‣Relationships formed
‣New understanding
Collaboration
‣New tech stack: more efficient
‣No more uWSGI!
Hardware efficiency
uWSGI Utilization
CPU Usage
‣New tech stack: more efficient
‣No more uWSGI!
‣Calls asynchronous
Hardware efficiency
‣How our systems work
‣Design for stability
‣Evenly spread ownership
Deeper Understanding
First & Last Name
Email: emilyr@uber.com
Engineering Blog: eng.uber.com
Twitter: @UberEng
Thank you
Watch the video with slide synchronization on
InfoQ.com!
https://www.infoq.com/presentations/uber-
darwin

Lessons Learned on Uber's Journey into Microservices