Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

111

description

Netflix morphed from a private datacenter based monolithic application into a cloud based Microservices architecture. This talk highlights the pros and cons of building software applications as suites of independently deployable services, as well as practical approaches for overcoming challenges - especially in the context of an elastic but ephemeral cloud ecosystem. What were the lessons learned while building and managing these services? What are the best practices and anti-patterns?

Transcript of Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Page 1: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 2: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 3: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

Page 4: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 5: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 6: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 7: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

Page 8: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 9: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 10: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Load Balancer

Monolithic App

Account

ComponentCatalog

Component

Recommendation

Component

Customer Service

Component

Database

Page 11: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 12: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Time

Page 13: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 14: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 15: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 16: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

User Accounts

Shopping Cart

Product Catalog

Customer Service

Page 17: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 18: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Product Catalog Customer Service

Page 19: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 20: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 21: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 22: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Tipping Point

& &

Organizational Growth Disverse Functionality Bottleneck in

Monolithic stack

Page 23: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

MicroServices

Perhaps?

Page 24: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

• Microservices

Page 25: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 26: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 27: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

MicroService

MegaService

Page 28: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Attribution: Adrian Cockroft, Martin Fowler …

Page 29: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Write programs that do one thing and do it well.

• Write programs to work together.

tr 'A-Z' 'a-z' < doc.txt | tr -cs 'a-z' '\n' | sort | uniq | comm -23 -

/usr/share/dict/words

Program to print misspelt words in doc.txt

Page 30: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Comparing Monolithic to MicroServices

Page 31: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 32: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Load Balancer

Monolithic App

Account

ComponentCatalog

Component

Recommendation

Component

Customer Service

Component

Database

Page 33: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Load Balancer

Account

ServiceCatalog

Service

Recommendation

ServiceCustomer Service

Service

Catalog

DB

API Gateway

Customer

DB

Page 34: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

• Microservices

– Why?

Page 35: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 36: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 37: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your

App/Service

Service X

Service Y

Service Z

Service L

Service M

Page 38: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

• Microservices

– Challenges and Solutions

Page 39: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 40: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Vs

Page 41: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Heterogeneity

Can lead to chaos if not designed right …

Page 42: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 43: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 44: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

non-JVM

Page 45: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 46: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Service Discovery

What’s your address?

Page 47: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Account

ServiceCatalog

Service

Recommendation

ServiceCustomer Service

Service

X

Service Y

Service

Z

Service

Registry

Service

(e.g. Netflix Eureka)

Page 48: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 49: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

2 Billion

~20 Billion Fan

1 Request 1 Request

Monolithic

AppMicroServices

Page 50: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 51: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your

App/Service

Service X

Service Y

Service Z

Cache

ClusterCache

Cluster

Tip: Config your TTL based on flexibility with data staleness!

Page 52: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your

App/Service

Service X

Service Y

Service Z

Cache

Cluster

Fn {A, B, C}

Cache

Cluster

Page 53: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 54: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

A/B Test

Service

User Account

Service

Service X Service Y Service ZApp

Page 55: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

A/B Test

Service

User Account

Service

Service X Service Y Service ZApp

reduces dependency

load

Page 56: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 57: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Data Serialization Overhead

Service A Service B Service C Service D

getMovies() getMovie() getMovieMetadata(

)C

l

i

e

n

t

D

C

l

i

e

n

t

C

C

l

i

e

n

t

B

Data

transformation

XAvroX

XmlJSON

Overall Response Time

Page 58: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 59: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 60: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

A single “bad” service can still bring your service down

Page 61: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 62: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 63: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your

App/Service

Service X

Service Y

Service Z

Service L

Service M

Page 64: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your

App/Service

Service X

Service Y

Service Z

Service L

Service M

Your

App/ServiceYour

App/Service

Page 65: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your

App/Service

Service X

Service Y

Service Z

Service L

Service M

Your

App/ServiceYour

App/Service

Service X

Service Y

Service Z

Service L

Service M

Page 66: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

http://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/WhatIsAutoScaling.html

Page 67: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

http://techblog.netflix.com/2013/11/scryer-

netflixs-predictive-auto-scaling.html

Page 68: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

1.

Page 69: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Account

Service 1

Recommendation

Service 1

Customer Service

Service 1

API Gateway

Account

Service N

Recommendation

Service N

Customer Service

Service N

Customer Service

Load Balancer

Reco Service

Load Balancer

Account Service

Load Balancer

ELB

Page 70: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 71: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Account

Service 1

Recommendation

Service 1

Customer Service

Service 1

API Gateway

Account

Service N

Recommendation

Service N

Customer Service

Service N

Account Service

LB

Recommendation

Service LB

Customer Service

Service LB

ELB

Page 72: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

http://github.com/netflix/ribbon

Page 73: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 74: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Service Dependency Visualization

Page 75: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Your Service

XY Farm

Page 76: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

How many dependencies does my service have?

What is the Call Volume on my Service?

Are any Dependency Services running Hot?

What are the Top N Slowest “Business Transactions”?

What are the sample HTTP Requests/Responses that had a

500 Error Code in the last 30 minutes?

Page 77: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

You

Your Service Dependency

Graph

Page 78: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 79: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 80: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 81: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 82: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 83: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 84: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

• Microservices

– Challenges and Solutions

– Best Practices

Page 85: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 86: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-network-security.html

Page 87: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 88: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 89: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

three

Page 90: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 91: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 92: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Fault Injection Testing (FIT)

Device ELB Service B

Service C

Internet Edge

Device or Account Override

Zuul

Service A

Request-level simulations

Refer Re:Invent Talk “Embracing Failure: Fault Injection and

Service Reliability” – PFC305

Page 93: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

https://github.com/Netflix/SimianArmy

Page 94: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 95: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 96: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

• Microservices

– Challenges and Solutions

– Best Practices

• InterProcess Communication

Page 97: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 98: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Netflix IPC Stack (1.0)

A

p

a

c

h

e

H

T

T

P

C

l

i

e

n

t

Eureka (Service

Registry)

Server (Karyon)

Apache

Tomcat

Client

H

y

s

t

r

i

x

E

V

C

a

c

h

e

Ribbon

Load

Balancing

Eureka

Integration

Metrics

(Servo)

Bootstrapping (Governator)

Metrics (Servo)

Admin ConsoleHTTP

Eureka Integration

Registration

Fetch Registry

A Blocking Architecture

Page 99: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Netflix IPC Stack (2.0)Client (Ribbon 2.0)

Eureka (Service

Registry)

Server (Karyon)

Ribbon Transport

Load

Balancing

Eureka

Integration

Metrics

(Servo)

Bootstrapping (Governator)

Metrics (Servo)

Admin Console

HTTP

Eureka Integration

Registration

Fetch Registry

Ribbon

Hystrix

EVCache

R

x

N

e

t

t

y

RxNetty

UDP

TCP

WebSockets

SSE

A Completely Reactive Architecture

Page 100: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Details: http://www.meetup.com/Netflix-Open-Source-

Platform/events/184153592/

Page 101: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 102: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

interface

recommendationsByUserId @Var "userId"

@Http(method = HttpMethod.GET, uriTemplate="/users/{userId}/recommendations")

@Hystrix(fallbackHandler = RecommendationFallbackHandler.class)

@EvCache(name = "movie-rec", appName = "movieService", cacheKeyTemplate = "{userId}")

MovieService movieService = Ribbon.from(MovieService.class);

Observable<Recommendations> result =

movieService.recommendationsByUserId(“user1”)

.toObservable();

Page 103: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

NetflixOSS

Page 104: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

NetflixOSS

http://netflix.github.co

Page 105: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

NetflixOSS

• Eureka

• Karyon

• Ribbon

• Hystrix

• Archaius

• Servo

• EVCache

• Curator/Exhibitor

Page 106: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Talk Time Title

PFC-305 Wednesday, 1:15pm Embracing Failure: Fault Injection and Service Reliability

BDT-403 Wednesday, 2:15pm Next Generation Big Data Platform at Netflix

PFC-306 Wednesday, 3:30pm Performance Tuning EC2

DEV-309 Wednesday, 3:30pm From Asgard to Zuul, How Netflix’s proven Open Source

Tools can accelerate and scale your services

ARC-317 Wednesday, 4:30pm Maintaining a Resilient Front-Door at Massive Scale

PFC-304 Wednesday, 4:30pm Effective Inter-process Communications in the Cloud: The

Pros and Cons of Micro Services Architectures

ENT-209 Wednesday, 4:30pm Cloud Migration, Dev-Ops and Distributed Systems

APP-310 Friday, 9:00am Scheduling using Apache Mesos in the Cloud

Page 107: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

• Netflix – background and evolution

• Monolithic Apps

• Microservices

– Challenges and Solutions

– Best Practices

• InterProcess Communication

• Takeaways

Page 108: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 109: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent
Page 110: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

http://techblog.netflix.com

http://netflix.github.io

http://martinfowler.com/articles/microservices.html

http://microservices.io/

Page 111: Pros and Cons of a MicroServices Architecture talk at AWS ReInvent

Please give us your feedback on this

presentation

Netflix Booth