uber’s journey into microservices - qcon new york · uber’s journey into microservices emily...

52
Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Upload: others

Post on 10-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Uber’s Journey into MicroservicesEmily Reinhold, Software Engineer, Uber

JUNE 15, 2016

Page 2: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Our Monolith

Background

Page 3: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣“API”

‣Started January 2011

Fun Facts

Page 4: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

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

Page 5: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣“API”

‣Started January 2011

‣Access to core data models

Fun Facts

Page 6: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Core Data ModelsUsers Trips Payments

Products Cities Documents

Exchange Rates Vehicles Promos

The Uber Monolith

Page 7: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Postgresql

‣Python 2.7

‣HTTP/JSON

‣uWSGI

Technical Details

Page 8: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Request FlowMatching Service

haproxy API box nginx uWSGI process

Postgres

Downstream Services

Third Parties

API

Page 9: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Minimal overhead for cross-domain features

Benefits

Page 10: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

“Cross Domain”Users Trips Payments

Products Cities Documents

Exchange Rates Vehicles Promos

The Uber Monolith

Page 11: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Minimal overhead for cross-domain features

‣Reuse code across domains

‣Broad, extensible interface

Benefits

Page 12: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣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

Page 13: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Postgresql Master Failure

Page 14: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Honks

‣Halloween 2014

‣Postgresql Master Failure

‣Kafka Outage

Historic Outages

Page 15: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Kafka Outage

Page 16: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Deploy burden

‣Single Postgres Master

Technical Bottlenecks

Image courtesy of Paul Schadler. Licensed under CC-BY 2.0.

https://flic.kr/p/aDoGkP

Page 17: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Rapid hiring

‣Slow test suite

‣Toe stepping, merge conflicts

Developability

Page 18: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Growth of business

‣Growth of features

‣Growth of organization

Scalability 3 Ways

Page 19: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

In Microservices

Our Future

Page 20: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Horizontally scalable

Benefits

Page 21: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Scalability

Trips Users Promos

Page 22: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Horizontally scalable

‣Improved onboarding

‣Clear ownership

Benefits

Page 23: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Ownership

No hiding!

You’re on call!

Page 24: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Horizontally scalable

‣Improved onboarding

‣Clear ownership

‣Failure isolation

Benefits

Page 25: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Granular FailuresOld Way

API

client show

Payments

Promos

User tags

Edge Service

New Way

Edge Service

Payments Promos Users

?

Page 26: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Lessons Learned

Page 27: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Drastically changing tech stack

Limit Scope

Page 28: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Tech StackThat’s me!

eng.uber.com/building-tincup/

Page 29: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Data Migration

1. Develop new schema

2. Implement converter

3. Dual write 4. Backfill

6. Move read queries

5. Validation ?

7. Remove old writes

Page 30: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Drastically changing tech stack

‣Infrastructure not ready ‣ Understaffed

‣ Lacked tooling

Limit Scope

Page 31: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Things Happen

Image courtesy of Kim Scarborough. Licensed under CC-BY-SA 2.0.

https://flic.kr/p/23HUAK

Page 32: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Drastically changing tech stack

‣Infrastructure not ready ‣ Understaffed

‣ Lacked tooling

‣Understanding timelines

Limit Scope

Page 33: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Monolith’s consumers directly impacted

Aligning with Consumers

Page 34: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Consumers

API

Pricing

Matching

Signup

Exchange rates

Cities

Users

Trips

Trips

Exchange Rates

Cities

Users

Page 35: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Monolith’s consumers directly impacted

‣Importance of migrating not well communicated

‣Constant interruption

Aligning with Consumers

Page 36: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣For service developers and migrating consumers

‣Tool to split up request

Build Tools Initially

Page 37: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Request Splitter

APICities

Currencies

Users

Trips

Old Wayrequesting trip info, with relationships on user, currency, city

New Way

APICities

Currencies

Users

Trips

Tool

requesting trip info, with relationships on user, currency, city

request user

request city

request currency

request trip

Page 38: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣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

Page 39: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Most difficult aspect of migration

‣Silently call new system

Consumer Migration Tips

Page 40: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Silent Swap

API

Matching

Signup

Exchange ratesCities

Users Trips

Users

Page 41: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Most difficult aspect of migration

‣Silently call new system

‣Most successful migration kept interface the same

Consumer Migration Tips

Page 42: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Tendency to avoid changes

‣Tackling core (User) directly required refactor

Love your Monolith

Page 43: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Likely to impact other teams

‣Teams shift focus

Migration Blockers

Page 44: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

Migration Successes

Page 45: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣Shared accomplishment

‣Relationships formed

‣New understanding

Collaboration

Page 46: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣New tech stack: more efficient

‣No more uWSGI!

Hardware efficiency

Page 47: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

uWSGI Utilization

Page 48: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

CPU Usage

Page 49: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣New tech stack: more efficient

‣No more uWSGI!

‣Calls asynchronous

Hardware efficiency

Page 50: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

‣How our systems work

‣Design for stability

‣Evenly spread ownership

Deeper Understanding

Page 51: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016

First & Last Name

Email: [email protected] Engineering Blog: eng.uber.com Twitter: @UberEng

Thank you

Page 52: Uber’s Journey into Microservices - QCon New York · Uber’s Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016