Ubers Journey into Microservices Emily Reinhold, Software Engineer, - - PowerPoint PPT Presentation

uber s journey into microservices
SMART_READER_LITE
LIVE PREVIEW

Ubers Journey into Microservices Emily Reinhold, Software Engineer, - - PowerPoint PPT Presentation

Ubers Journey into Microservices Emily Reinhold, Software Engineer, Uber JUNE 15, 2016 Background Our Monolith Fun Facts API Started January 2011 API Trends Lines of Code over Time Unique Authors over Time 300K 600 225K


slide-1
SLIDE 1

Uber’s Journey into Microservices

Emily Reinhold, Software Engineer, Uber

JUNE 15, 2016

slide-2
SLIDE 2

Our Monolith

Background

slide-3
SLIDE 3
  • “API”
  • Started January 2011

Fun Facts

slide-4
SLIDE 4

Lines of Code over Time

0K 75K 150K 225K 300K 2011 2012 2013 2014 2015 2016

Unique Authors over Time

150 300 450 600 2011 2012 2013 2014 2015 2016

Start of migration. Yay!

API Trends

slide-5
SLIDE 5
  • “API”
  • Started January 2011
  • Access to core data models

Fun Facts

slide-6
SLIDE 6

Core Data Models

Users Trips Payments Products

Cities

Documents Exchange Rates

Vehicles

Promos

The Uber Monolith

slide-7
SLIDE 7
  • Postgresql
  • Python 2.7
  • HTTP/JSON
  • uWSGI

Technical Details

slide-8
SLIDE 8

Request Flow

Matching Service haproxy API box nginx uWSGI process

Postgres Downstream Services Third Parties

API

slide-9
SLIDE 9
  • Minimal overhead for cross-

domain features

Benefits

slide-10
SLIDE 10

“Cross Domain”

Users Trips Payments Products

Cities

Documents Exchange Rates

Vehicles

Promos

The Uber Monolith

slide-11
SLIDE 11
  • Minimal overhead for cross-

domain features

  • Reuse code across domains
  • Broad, extensible interface

Benefits

slide-12
SLIDE 12
  • 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

slide-13
SLIDE 13

Postgresql Master Failure

slide-14
SLIDE 14
  • Honks
  • Halloween 2014
  • Postgresql Master Failure
  • Kafka Outage

Historic Outages

slide-15
SLIDE 15

Kafka Outage

slide-16
SLIDE 16
  • Deploy burden
  • Single Postgres Master

Technical Bottlenecks

Image courtesy of Paul Schadler. Licensed under CC-BY 2.0. https://flic.kr/p/aDoGkP

slide-17
SLIDE 17
  • Rapid hiring
  • Slow test suite
  • Toe stepping, merge conflicts

Developability

slide-18
SLIDE 18
  • Growth of business
  • Growth of features
  • Growth of organization

Scalability 3 Ways

slide-19
SLIDE 19

In Microservices

Our Future

slide-20
SLIDE 20
  • Horizontally scalable

Benefits

slide-21
SLIDE 21

Scalability

Trips Users Promos

slide-22
SLIDE 22
  • Horizontally scalable
  • Improved onboarding
  • Clear ownership

Benefits

slide-23
SLIDE 23

Ownership

No hiding! You’re on call!

slide-24
SLIDE 24
  • Horizontally scalable
  • Improved onboarding
  • Clear ownership
  • Failure isolation

Benefits

slide-25
SLIDE 25

Granular Failures

Old Way

API

client show Payments Promos User tags

Edge Service

New Way

Edge Service Payments Promos Users

?

slide-26
SLIDE 26

Lessons Learned

slide-27
SLIDE 27
  • Drastically changing tech

stack

Limit Scope

slide-28
SLIDE 28

Tech Stack

That’s me!

eng.uber.com/building-tincup/

slide-29
SLIDE 29

Data Migration

  • 1. Develop new

schema

  • 2. Implement

converter

  • 3. Dual write
  • 4. Backfill
  • 6. Move read

queries

  • 5. Validation

?

  • 7. Remove old

writes

slide-30
SLIDE 30
  • Drastically changing tech

stack

  • Infrastructure not ready
  • Understaffed
  • Lacked tooling

Limit Scope

slide-31
SLIDE 31

Things Happen

Image courtesy of Kim Scarborough. Licensed under CC-BY-SA 2.0. https://flic.kr/p/23HUAK

slide-32
SLIDE 32
  • Drastically changing tech

stack

  • Infrastructure not ready
  • Understaffed
  • Lacked tooling
  • Understanding timelines

Limit Scope

slide-33
SLIDE 33
  • Monolith’s consumers

directly impacted

Aligning with Consumers

slide-34
SLIDE 34

Consumers

API

Pricing Matching Signup Exchange rates Cities Users Trips Trips Exchange Rates Cities Users

slide-35
SLIDE 35
  • Monolith’s consumers directly impacted
  • Importance of migrating not well

communicated

  • Constant interruption

Aligning with Consumers

slide-36
SLIDE 36
  • For service developers and

migrating consumers

  • Tool to split up request

Build Tools Initially

slide-37
SLIDE 37

Request Splitter

API

Cities Currencies Users Trips

Old Way

requesting trip info, with relationships

  • n user,

currency, city

New Way API

Cities Currencies Users Trips

Tool

requesting trip info, with relationships

  • n user,

currency, city request user request city request currency request trip

slide-38
SLIDE 38
  • 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

slide-39
SLIDE 39
  • Most difficult aspect of migration
  • Silently call new system

Consumer Migration Tips

slide-40
SLIDE 40

Silent Swap

API

Matching Signup Exchange rates Cities Users Trips Users

slide-41
SLIDE 41
  • Most difficult aspect of migration
  • Silently call new system
  • Most successful migration kept

interface the same

Consumer Migration Tips

slide-42
SLIDE 42
  • Tendency to avoid changes
  • Tackling core (User) directly

required refactor

Love your Monolith

slide-43
SLIDE 43
  • Likely to impact other teams
  • Teams shift focus

Migration Blockers

slide-44
SLIDE 44

Migration Successes

slide-45
SLIDE 45
  • Shared accomplishment
  • Relationships formed
  • New understanding

Collaboration

slide-46
SLIDE 46
  • New tech stack: more efficient
  • No more uWSGI!

Hardware efficiency

slide-47
SLIDE 47

uWSGI Utilization

slide-48
SLIDE 48

CPU Usage

slide-49
SLIDE 49
  • New tech stack: more efficient
  • No more uWSGI!
  • Calls asynchronous

Hardware efficiency

slide-50
SLIDE 50
  • How our systems work
  • Design for stability
  • Evenly spread ownership

Deeper Understanding

slide-51
SLIDE 51

First & Last Name Email: emilyr@uber.com Engineering Blog: eng.uber.com Twitter: @UberEng

Thank you

slide-52
SLIDE 52