Top Banner
Ten Cloud Design Patterns Shlomo Swidler Founder Orchestratus
61

Ten^H^H^H Many Cloud App Design Patterns

May 17, 2015

Download

Technology

Shlomo Swidler

What kind of design patterns are useful for applications adopting the cloud? How can apps achieve the scalability and availability promised by the cloud? Presentation from Interop 2011 Enterprise Cloud Summit.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Ten^H^H^H Many Cloud App Design Patterns

Ten CloudDesign Patterns

Shlomo SwidlerFounder

Orchestratus

Page 2: Ten^H^H^H Many Cloud App Design Patterns

2 of 61

Shlomo Swidler

• Founder, Orchestratus– Strategic and technical

IT consulting– Customers include:

• Cloud Developer Tips bloghttp://shlomoswidler.com/

• Among top community-ranked contributors to Amazon Web Services discussion forums

Page 3: Ten^H^H^H Many Cloud App Design Patterns

Ten CloudDesign Patterns

Shlomo SwidlerFounder

Orchestratus

Page 4: Ten^H^H^H Many Cloud App Design Patterns

Ten Cloud ApplicationDesign Patterns

Shlomo SwidlerFounder

Orchestratus

Page 5: Ten^H^H^H Many Cloud App Design Patterns

Ten Cloud ApplicationDesign Patterns

Shlomo SwidlerFounder

Orchestratus

Many

Page 6: Ten^H^H^H Many Cloud App Design Patterns

6 of 61

What is a Design Pattern

• A reusable recipe for building (software) systems that solve a particular problem.

Page 7: Ten^H^H^H Many Cloud App Design Patterns

7 of 61

What is a Design Pattern

• A reusable recipe for building (software) systems that solve a particular problem.

AKA Architectural Pattern

Page 8: Ten^H^H^H Many Cloud App Design Patterns

8 of 61

What is a Design Pattern

• A reusable recipe for building (software) systems that solve a particular problem.

Constraints AvailableResources

Goal

Page 9: Ten^H^H^H Many Cloud App Design Patterns

9 of 61

A Design Pattern

• A reusable recipe for building (software) systems that solve a particular problem.

Constraints AvailableResources

Goal

Meets affirmativerequirements

Can be implemented

Does not violatenegative requirements

Page 10: Ten^H^H^H Many Cloud App Design Patterns

10 of 61

Challenges Faced by Apps in the Cloud

• Application Scalability– Cloud promises rapid (de)provisioning of resources.– How do you tap into that to create scalable

systems?• Application Availability– Underlying resource failures happen

… usually more frequently than intraditional data centers.

– How do you overcome that to create highly available systems?

Page 11: Ten^H^H^H Many Cloud App Design Patterns

11 of 61

The Scalability Challenge

• Scalability: Handle more (or fewer) requests– It’s not Performance (handle requests faster)– It’s not Availability (tolerate failures)• But improving Scalability often improves Availability

Page 12: Ten^H^H^H Many Cloud App Design Patterns

12 of 61

The Scalability Challenge

• Two different components to scale:– State (inputs, data store, output)– Behavior (business logic)

• Any non-trivial application has both.• Scaling one component means scaling the

other, too.

Page 13: Ten^H^H^H Many Cloud App Design Patterns

13 of 61

App Scalability Patterns for State

• Data Grids• Distributed Caching• HTTP Caching

– Reverse Proxy– CDN

• Concurrency– Message-Passing– Dataflow– Software Transactional

Memory– Shared-State

• Partitioning

• CAP theorem: Data Consistency– Eventually Consistent– Atomic Data

• DB Strategies– RDBMS

• Denormalization• Sharding

– NOSQL• Key-Value store• Document store• Data Structure store• Graph database

Page 14: Ten^H^H^H Many Cloud App Design Patterns

14 of 61

App Scalability Patterns for Behavior

• Compute Grids• Event-Driven Architecture

– Messaging– Actors– Enterprise Service Bus– Domain Events– Event Stream Processing– Event Sourcing– Command & Query

Responsibility Segregation (CQRS)

• Load Balancing– Round-robin– Random– Weighted– Dynamic

• Parallel Computing– Master/Worker– Fork/Join– MapReduce– SPMD– Loop Parallelism

Page 15: Ten^H^H^H Many Cloud App Design Patterns

15 of 61

The Availability Challenge

• Availability: Tolerate failures• Traditional IT focuses on increasing MTTF– Mean Time to Failure

• Cloud IT focuses on reducing MTTR– Mean Time to Recovery

Page 16: Ten^H^H^H Many Cloud App Design Patterns

16 of 61

The Availability Challenge

• Availability: Tolerate failures• Traditional IT focuses on increasing MTTF– Mean Time to Failure

• Cloud IT focuses on reducing MTTR– Mean Time to Recovery

• What follows is four availability scenarios:[low, high] X [MTTF, MTTR]

Page 17: Ten^H^H^H Many Cloud App Design Patterns

17 of 61

Availability and MTTF, MTTR

< MTTF, > MTTR

< MTTF, < MTTR

> MTTF, < MTTR

> MTTF, > MTTR Up 1Down 1Up 2Down 2Up 3Down 3Up 4Down 4Up 5Down 5Up 6Down 6Up 7

Page 18: Ten^H^H^H Many Cloud App Design Patterns

18 of 61

Availability and MTTF, MTTR

< MTTF, > MTTR

< MTTF, < MTTR

> MTTF, < MTTR

> MTTF, > MTTR Up 1Down 1Up 2Down 2Up 3Down 3Up 4Down 4Up 5Down 5Up 6Down 6Up 7

53%

Uptime

86%

69%

30%

Page 19: Ten^H^H^H Many Cloud App Design Patterns

19 of 61

Availability and MTTF, MTTR

< MTTF, > MTTR

< MTTF, < MTTR

> MTTF, < MTTR

> MTTF, > MTTR Up 1Down 1Up 2Down 2Up 3Down 3Up 4Down 4Up 5Down 5Up 6Down 6Up 7

53%

Uptime

86%

69%

30%

Traditional IT

Page 20: Ten^H^H^H Many Cloud App Design Patterns

20 of 61

Availability and MTTF, MTTR

< MTTF, > MTTR

< MTTF, < MTTR

> MTTF, < MTTR

> MTTF, > MTTR Up 1Down 1Up 2Down 2Up 3Down 3Up 4Down 4Up 5Down 5Up 6Down 6Up 7

53%

Uptime

86%

69%

30%

Traditional IT

Cloud

Page 21: Ten^H^H^H Many Cloud App Design Patterns

21 of 61

Availability and MTTF, MTTR

< MTTF, > MTTR

< MTTF, < MTTR

> MTTF, < MTTR

> MTTF, > MTTR Up 1Down 1Up 2Down 2Up 3Down 3Up 4Down 4Up 5Down 5Up 6Down 6Up 7

53%

Uptime

86%

69%

30%

Traditional IT

Cloud

Cloud done wrong

Page 22: Ten^H^H^H Many Cloud App Design Patterns

22 of 61

Design Patterns for Availability

• Pattern: Replication• Pattern: Fail-Over

• Often used together.

Page 23: Ten^H^H^H Many Cloud App Design Patterns

23 of 61

Availability Pattern: Fail-Over

Source: Michael Nygaard

Page 24: Ten^H^H^H Many Cloud App Design Patterns

24 of 61

Availability Pattern: Fail-Over

In practice, fail-over is not this simple

Source: Michael Nygaard

Page 25: Ten^H^H^H Many Cloud App Design Patterns

25 of 61

Availability Pattern: Fail-Over

Source: Michael Nygaard

Page 26: Ten^H^H^H Many Cloud App Design Patterns

26 of 61

Availability Pattern: Fail-Over with Fail-Back

Source: Michael Nygaard

Page 27: Ten^H^H^H Many Cloud App Design Patterns

27 of 61

Availability’s Nemesis

• Single Points of Failure

Page 28: Ten^H^H^H Many Cloud App Design Patterns

SPOT the SPOF*

*Single Point of Failure

Page 29: Ten^H^H^H Many Cloud App Design Patterns

29 of 61

Spot the SPOF: 1Internet

Cloud

App InstanceApp

Page 30: Ten^H^H^H Many Cloud App Design Patterns

30 of 61

Spot the SPOF: 1b

App

Internet

Cloud

App Instance

Page 31: Ten^H^H^H Many Cloud App Design Patterns

31 of 61

Spot the SPOF: 1bInternet

Cloud

App InstanceApp

Page 32: Ten^H^H^H Many Cloud App Design Patterns

32 of 61

Spot the SPOF: 2

App

Internet

Cloud

App Instance

Elastic IP Address

App

App Instance

Fail-over

Page 33: Ten^H^H^H Many Cloud App Design Patterns

33 of 61

Spot the SPOF: 2

App

Internet

Cloud

App Instance

Elastic IP Address

App

App Instance

Might work…Until you need more App instancesOr until another SPOF fails…

Fail-over

Page 34: Ten^H^H^H Many Cloud App Design Patterns

34 of 61

Spot the SPOF: 2aInternet

Cloud

LB Load Balancer Instance

App App

Page 35: Ten^H^H^H Many Cloud App Design Patterns

35 of 61

Spot the SPOF: 2aInternet

Cloud

LB Load Balancer Instance

App App

Page 36: Ten^H^H^H Many Cloud App Design Patterns

36 of 61

Spot the SPOF: 3

Availability Zone

Internet

Cloud

LB

Replicated configuration

LB

Elastic IP Address

App App

Fail-over

Page 37: Ten^H^H^H Many Cloud App Design Patterns

37 of 61

Spot the SPOF: 3

Availability Zone

Internet

Cloud

LB

Replicated configuration

LB

App App

Fail-over

Elastic IP Address

Page 38: Ten^H^H^H Many Cloud App Design Patterns

38 of 61

Spot the SPOF: 4

Availability Zone

Internet

Cloud

ELB Elastic Load Balancer (Magic)

AppApp

Page 39: Ten^H^H^H Many Cloud App Design Patterns

39 of 61

Spot the SPOF: 4

Availability Zone

Internet

Cloud

ELB Elastic Load Balancer (Magic)

AppApp

Page 40: Ten^H^H^H Many Cloud App Design Patterns

40 of 61

Spot the SPOF: 5Internet

Region

Availability Zone

LB

App App

Availability Zone

LB

App App

Replicated configuration

Elastic IP Address

Fail-over

Page 41: Ten^H^H^H Many Cloud App Design Patterns

41 of 61

Spot the SPOF: 5Internet

Availability Zone

LB

App App

Availability Zone

LB

App App

RegionReplicated configuration

Elastic IP Address

Fail-over

Page 42: Ten^H^H^H Many Cloud App Design Patterns

42 of 61

Spot the SPOF: 6

Availability Zone

Internet

Region

ELB Elastic Load Balancer (Magic)

Availability Zone

AppApp

AppApp

Page 43: Ten^H^H^H Many Cloud App Design Patterns

43 of 61

Spot the SPOF: 6

Availability Zone

Internet

Region

ELB Elastic Load Balancer (Magic)

Availability Zone

AppApp

AppApp

Page 44: Ten^H^H^H Many Cloud App Design Patterns

44 of 61

Spot the SPOF: 7Internet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Or…

Page 45: Ten^H^H^H Many Cloud App Design Patterns

45 of 61

Spot the SPOF: 7aInternet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Page 46: Ten^H^H^H Many Cloud App Design Patterns

46 of 61

Spot the SPOF: 7/7aInternet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Elastic IPs aresingle-region only

Page 47: Ten^H^H^H Many Cloud App Design Patterns

47 of 61

Spot the SPOF: 7bInternet

ELB

RegionRegion

Availability Zone

AppApp

Availability Zone

AppApp

Availability Zone

AppApp

Availability Zone

AppApp

Page 48: Ten^H^H^H Many Cloud App Design Patterns

48 of 61

Spot the SPOF: 7bInternet

ELB

RegionRegion

Availability Zone

AppApp

Availability Zone

AppApp

Availability Zone

AppApp

Availability Zone

AppApp

ELB is single-region only

Page 49: Ten^H^H^H Many Cloud App Design Patterns

49 of 61

Spot the SPOF: 7c

Availability Zone

Internet

ELB

Region

Availability ZoneAvailability Zone

Region

Availability Zone

ELB

DNS

AppApp

AppApp

AppApp

AppApp

Page 50: Ten^H^H^H Many Cloud App Design Patterns

50 of 61

Spot the SPOF: 7c

Availability Zone

Internet

ELB

Region

Availability ZoneAvailability Zone

Region

Availability Zone

ELB

DNS

AppApp

AppApp

AppApp

AppApp

ELB Can’t Do ThatMultiple CNAMEs Violate RFC 2181

Page 51: Ten^H^H^H Many Cloud App Design Patterns

51 of 61

Spot the SPOF: 7dInternet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNS

Page 52: Ten^H^H^H Many Cloud App Design Patterns

52 of 61

Spot the SPOF: 7dInternet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNSCloud Provider

Page 53: Ten^H^H^H Many Cloud App Design Patterns

AWS

Spot the SPOF: 8Internet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNS

Rackspace

53

LB

App App

Page 54: Ten^H^H^H Many Cloud App Design Patterns

AWS

Spot the SPOF: 8Internet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNS

Rackspace

54

LB

App App

Page 55: Ten^H^H^H Many Cloud App Design Patterns

AWS

Spot the SPOF: 8Internet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNS

Rackspace

55

LB

App App

and...

Page 56: Ten^H^H^H Many Cloud App Design Patterns

AWS

Spot the SPOF: 8Internet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNS

Rackspace

56

LB

App App

and...Fail-overmechanism

Page 57: Ten^H^H^H Many Cloud App Design Patterns

AWS

Spot the SPOF: 8Internet

RegionRegion

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

Availability Zone

LB

App App

DNS

Rackspace

57

LB

App App

and...Ops staff andFail-overmechanism

Page 58: Ten^H^H^H Many Cloud App Design Patterns

58 of 61

Availability: Ensure Redundancies

• Physical• Virtual resource (instance, disk, etc.)• Availability zone• Region• Provider• Human (ops staff)

Page 59: Ten^H^H^H Many Cloud App Design Patterns

59 of 61

Availability Best Practice:Chaos Monkey

• AKA Error Injection Testing– Forcibly create fault conditions in your cloud

components.– Kill instances, detach disks, screw up DNS, etc.

• Automate recovery from the errors.• The team gets really good at reducing MTTR,

increasing availability!• Popularized by Netflix, who run it on their live

environment.

Page 60: Ten^H^H^H Many Cloud App Design Patterns

60 of 61

For more on Designing forAvailability, Scalability

• Jonas BonérScalability, Availability, Stability Patterns http://slidesha.re/cK3NJv

• George ReeseThe AWS Outage: The Cloud’s Shining Momenthttp://oreil.ly/eKCGG9

• John Ciancutti of Netflix5 Lessons We’ve Learned Using AWShttp://bit.ly/h8rU8b

Page 61: Ten^H^H^H Many Cloud App Design Patterns

Ten Cloud ApplicationDesign Patterns

Shlomo SwidlerFounder

[email protected]

@ShlomoSwidler

ManyThank you!