qcon 111122082620-phpapp02

63
Derek Collison Design and Architecture

Upload: newlink

Post on 02-Nov-2014

517 views

Category:

Technology


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Qcon 111122082620-phpapp02

Derek Collison

Design and Architecture

Page 2: Qcon 111122082620-phpapp02

What isCloud Foundry?

2

Page 3: Qcon 111122082620-phpapp02

The OpenPlatform as a Service

3

Page 4: Qcon 111122082620-phpapp02

What is PaaS?

4

Page 5: Qcon 111122082620-phpapp02

Or more specifically, aPaaS?

5

Page 6: Qcon 111122082620-phpapp02

aPaaS

• Application Platform as a Service

• Applications and Services

6

Page 7: Qcon 111122082620-phpapp02

aPaaS

• Application Platform as a Service

• Applications and Services

• Not • VMs

• Memory

• Storage

• Networks

• CPU

7

Page 8: Qcon 111122082620-phpapp02

What isOpenPaaS?

8

Page 9: Qcon 111122082620-phpapp02

OpenPaaS

• Multi-Language

• Multi-Framework

• Multi-Services

• Multi-Cloud, Multi-IaaS

• Hybrid - Public or Private or Both

• OpenSource

9

Page 10: Qcon 111122082620-phpapp02

OpenPaaS

• Multi-Language• Ruby, Java, Scala, Node.js, Erlang, Python, PHP..

• Multi-Framework• Rails, Sinatra, Spring, Grails, Express, Lift

• Multi-Services• MySQL, Postgres, MongoDB, Redis, RabbitMQ

• Multi-Cloud, Multi-IaaS• vSphere, MicroCloud, OpenStack, AWS

10

Page 11: Qcon 111122082620-phpapp02

The Open PaaS

Clou

d Pr

ovide

r Int

erfa

ce

Application Service Interface

Private Clouds

PublicClouds

MicroClouds

11

Data Services

Other Services

Msg Services

vFabric Postgres

vFabric RabbitMQTM

Page 12: Qcon 111122082620-phpapp02

What isour Goal?

12

Page 13: Qcon 111122082620-phpapp02

What was our Goal?

13

Raise the unit of currency to be the application and its associated services,

not the infrastructure

Page 14: Qcon 111122082620-phpapp02

What was our Goal?

14

Best of breed delivery platform for all modern

applications and frameworks

Page 15: Qcon 111122082620-phpapp02

What was our Goal?

15

Favor Choice

and

Openness

Page 16: Qcon 111122082620-phpapp02

How was it Built?

16

Page 17: Qcon 111122082620-phpapp02

How was it Built?

• Kernel (CloudFoundry OSS)• Core PaaS System

• Kernel and Orchestrator Shells• Layered on top of IaaS

• Orchestrator• IaaS creation, management and

orchestration

17

Page 18: Qcon 111122082620-phpapp02

High Level

18

IaaS

Orchestrator

CF Kernel

Hardware - CPU/Memory/Disk/Network

Clients (VMC, STS, Browser)

Page 19: Qcon 111122082620-phpapp02

Basic Premises

• Fail Fast

• Self Healing

• Horizontally Scalable Components

• Distributed State

• No Single Point of Failure

• Should be as simple as possible

19

Page 20: Qcon 111122082620-phpapp02

Basic Patterns

• Event-Driven

• Asynchronous

• Non-blocking

• Independent, Idempotent

• Message Passing

• Eventually Consistent

20

Page 21: Qcon 111122082620-phpapp02

Basic Design

• All components loosely coupled• Few “Classes”, many “Instances”

• Messaging as foundation• Addressing and Component Discovery

• Command and Control

• JSON payloads

• HTTP or File/Blob for data transport

21

Page 22: Qcon 111122082620-phpapp02

Kernel Components

• All dynamically discoverable

• Launch and scale in any order

• Can come and go as needed

• Monitor via HTTP and JSON

• Location independent

22

Page 23: Qcon 111122082620-phpapp02

Kernel Components

• Router

• CloudController

• DEA

• HealthManager

• Service Provisioning Agent

• Messaging System

23

Page 24: Qcon 111122082620-phpapp02

Logical View

24

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 25: Qcon 111122082620-phpapp02

25

Arc

hit

ec

ture

Page 26: Qcon 111122082620-phpapp02

Messaging

26

Page 27: Qcon 111122082620-phpapp02

Messaging

27

“The Nervous System”

Page 28: Qcon 111122082620-phpapp02

Messaging

28

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 29: Qcon 111122082620-phpapp02

Messaging

• Addressing and Discovery• No static IPs or DNS lookups req’d

• Just Layer 4

• Command and Control

• Central communication system

• Dial tone, fire and forget

• Protects *itself* at all costs

• Idempotent semantics

29

Page 30: Qcon 111122082620-phpapp02

Router

30

Page 31: Qcon 111122082620-phpapp02

Router

31

“Traffic Cop”

Page 32: Qcon 111122082620-phpapp02

Router

32

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 33: Qcon 111122082620-phpapp02

Router

• Handles all HTTP traffic

• Maintains distributed routing state

• Routes URLs to applications

• Distributes load among instances

• Realtime distributed updates to routing tables from DEAs

33

Page 34: Qcon 111122082620-phpapp02

CloudController

34

Page 35: Qcon 111122082620-phpapp02

CloudController

35

“The King”

Page 36: Qcon 111122082620-phpapp02

CloudController

36

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 37: Qcon 111122082620-phpapp02

CloudController

• Handles all state transitions

• Deals with users, apps, and services

• Packages and Stages applications

• Binds Services to Applications

• Presents external REST API

37

Page 38: Qcon 111122082620-phpapp02

HealthManager

38

Page 39: Qcon 111122082620-phpapp02

HealthManager

39

“Court Jester”

Page 40: Qcon 111122082620-phpapp02

HealthManager

40

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 41: Qcon 111122082620-phpapp02

HealthManager

• Monitors the state of the world

• Initial value with realtime delta updates to “intended” vs “real”

• Determines drift

• Complains to the CloudControllers when something is not correct

• No power to change state itself

41

Page 42: Qcon 111122082620-phpapp02

DEA

42

Page 43: Qcon 111122082620-phpapp02

DEA

43

“Droplet Execution Agent”

Page 44: Qcon 111122082620-phpapp02

DEA

44

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 45: Qcon 111122082620-phpapp02

DEA (Droplet Execution Agent)

• Responsible for running all applications

• Monitors all applications

• CPU, Mem, IO, Threads, Disk, FDs, etc

• All apps look same to DEA• start and stop

• Express ability and desire to run an application• runtimes, options, cluster avoidance, memory/cpu

• Alerts on any change in state of applications

• Provides secure/constrained OS runtime

• Hypervisor, Unix File and User, Linux Containers*

• Single or Multi-Tenant

45

Page 46: Qcon 111122082620-phpapp02

How does it allWork?

46

Page 47: Qcon 111122082620-phpapp02

Pushing an App

• Client (VMC/STS) pushes meta-data to CC

• Client optionally pushes resource signatures (diff analysis, sys wide)

• Client pushes app resources to CC

• CC puts app together

• CC stages app asynchronously

• CC binds and stages services

• Droplet ready

47

Page 48: Qcon 111122082620-phpapp02

48

Arc

hit

ec

ture

Page 49: Qcon 111122082620-phpapp02

Running an App

• CC asks DEAs for “help”

• First DEA back wins! Simple

• CC sends start request to selected DEA

• DEA pushes the “green” button

• DEA waits and monitors pid and ephemeral port for app to bind

• When app is healthy, sends “register” message

• Register message is seen by HM and Routers

• Routers bind URL to host:port

49

Page 50: Qcon 111122082620-phpapp02

DEAs answer?

• DEAs first determine YES or NO• correct runtime, options, memory, etc

• Then calculate a Delay Taint• SHA hash of application

• memory

• cpu

• Taint allows balancing and selection

50

Page 51: Qcon 111122082620-phpapp02

Scale up & down?

• Exact steps as running the app the first time

• SHA1 taint helps avoid clustering

• memory/cpu taint helps distribute as evenly as possible

• Nothing pre-computed

• Nothing assumed

51

Page 52: Qcon 111122082620-phpapp02

Crashes?

• If your app stops and we did not tell it to, that is a crash

• Crashed apps are immediately detected by DEA and messaged

• Routers disconnect route instantly

• HM will signal CC• something is wrong

• CC will issue run sequence again52

Page 53: Qcon 111122082620-phpapp02

53

Arc

hit

ec

ture

Page 54: Qcon 111122082620-phpapp02

Access to my App?

• All routers understand where all instances of your application are running

• Will randomly pick backend, not semantically aware.

• Will remove routes that are stale or unhealthy

• Session stickiness and replication available, but best to avoid if possible

54

Page 55: Qcon 111122082620-phpapp02

What aboutServices?

55

Page 56: Qcon 111122082620-phpapp02

Services

56

VMC client STS plugin Browser(user app access)

Routers

CloudControllers App

Services

App

HealthManager

DEA Pool

Messaging

Page 57: Qcon 111122082620-phpapp02

Services

• Service Advertisement

• Service Provisioning

• Gateway fronts multi-backends

• Service Nodes scale independent

• App and service talk directly

• API to register into system

• Closure for additional value

57

Page 58: Qcon 111122082620-phpapp02

Provisioning

58

VMC/STS

Routers

CloudControllers Services Gateway

Service NodeMySQL

Service NodeRedis

Service NodeRedis

Messaging

Application

1

2

3

45

6

Page 59: Qcon 111122082620-phpapp02

Access (Direct)

59

Routers

CloudControllers Services Gateway

Service NodeMySQL

Service NodeRedis

Service NodeRedis

Messaging

Application

1

2

Browser(user app access)

Page 60: Qcon 111122082620-phpapp02

Services

60

Cloud Foundry

vSphere

core services

Enterprise Services

SQLFire

apps

service controller service broker

provision/bind

consume consume

bind

VMware Dev Tools Partner Dev Tools

Data Director

Relational DB

Page 61: Qcon 111122082620-phpapp02

Learn more:

www.cloudfoundry.org

blog.cloudfoundry.com

support.cloudfoundry.com

61

Page 62: Qcon 111122082620-phpapp02

62

Thank You