cloudfoundry architecture

97
Cloud Foundry Architecture Ramnivas Laddad @ramnivas © 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.

Upload: ramnivas-laddad

Post on 13-May-2015

11.679 views

Category:

Technology


1 download

DESCRIPTION

Cloud Foundry Architecture presentation at SpringOne 2012.

TRANSCRIPT

Page 1: Cloudfoundry architecture

Cloud Foundry Architecture Ramnivas Laddad

@ramnivas

© 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.

Page 2: Cloudfoundry architecture

@ramnivas •  Spring framework committer •  Cloud Foundry committer •  Main interests

–  Cloud computing –  Aspect-oriented programming –  Scala and functional programming

•  Author of books and articles –  AspectJ in Action (1st and 2nd edition)

•  Speaker at many professional conferences –  JavaOne, JavaPolis, SpringOne, Software Development, No Fluff Just Stuff, EclipseCon,

O’Reilly OSCON etc.

•  Active involvement in AspectJ, Spring, and Cloud Foundry since their early form

Page 3: Cloudfoundry architecture

Technologies “Я” Us

RabbitMQ

Postgres

REST

MySQL JPA

Hibernate JDBC

Django

node.js Redis

JTA

JMS

Web Services

Spring

Security

Caching

Mongo AMQP

Neo4j

JSF

Sinatra

Testing Scripting

HTML5

Rails Lift

Batch Job

LDAP

Grails

Ruby

Java

Python

Akka Scala

Closure

Hadoop

Page 4: Cloudfoundry architecture

Technologies “Я” Us

RabbitMQ

Postgres

REST

MySQL JPA

Hibernate JDBC

Django

node.js Redis

JTA

JMS

Web Services

Spring

Security

Caching

Mongo AMQP

Neo4j

JSF

Sinatra

Testing Scripting

HTML5

Rails Lift

Batch Job

LDAP

Grails

Ruby

Java

Python

Akka Scala

Closure

Hadoop

Page 5: Cloudfoundry architecture

Technologies “Я” Us

Monitoring

Hardware failures

Backups

Rolling Updates

Patches

Security DoS

OS

DNS Storage Routing

DBA

Network

Load balancing

User management Auditing

Access logs

Page 6: Cloudfoundry architecture

Technologies “Я” Us

Monitoring

Hardware failures

Backups

Rolling Updates

Patches

Security DoS

OS

DNS Storage Routing

DBA

Network

Load balancing

User management Auditing

Access logs

Page 7: Cloudfoundry architecture

§ More functionality § Time to market pressure § Complex integration § Higher stake in quality

Facets of complexity: Product

Page 8: Cloudfoundry architecture

§ Sound architecture: future proofing without overdoing § Unit and integration tests § Responding to changing business needs § Confusing technology landscape

Facets of complexity: Development

Page 9: Cloudfoundry architecture

§ Choosing the right hardware, operating system, web server § Monitoring applications § Responding to scalability needs § Dealing with hardware- and system-level failures § Upgrading without substantial down time

Facets of complexity: Deployment and operation

Page 10: Cloudfoundry architecture

Inherent vs. Apparent Complexity

Implementation

Page 11: Cloudfoundry architecture

Inherent vs. Apparent Complexity

Implementation Functional logic

Page 12: Cloudfoundry architecture

Inherent vs. Apparent Complexity

Implementation Functional logic Inherent

complexity

Page 13: Cloudfoundry architecture

Inherent vs. Apparent Complexity

Implementation Functional logic

Implementation overhead

Inherent complexity

Page 14: Cloudfoundry architecture

Inherent vs. Apparent Complexity

Implementation Functional logic

Implementation overhead

Inherent complexity

Apparent complexity

Page 15: Cloudfoundry architecture

Inherent vs. Apparent Complexity

Implementation Functional logic

Implementation overhead

Inherent complexity

Apparent complexity

What can we do about this?

Page 16: Cloudfoundry architecture

What can we do?

?

Page 17: Cloudfoundry architecture

SaaS Software as a Service

PaaS Platform as a Service

IaaS Infrastructure as a Service

Three layers of Cloud Computing

Page 18: Cloudfoundry architecture

Private    Clouds    

Public  Clouds  

Micro  Clouds  

Cloud Foundry open PaaS - Choice of clouds

Data Services

Other Services

Msg Services

Page 19: Cloudfoundry architecture

Private    Clouds    

Public  Clouds  

Data Services

Other Services

Msg Services

Apache2 license

Micro  Clouds  

Cloud Foundry open PaaS - Choice of clouds

Page 20: Cloudfoundry architecture

Private    Clouds    

Public  Clouds  

Data Services

Other Services

Msg Services

Partners  

Apache2 license

Micro  Clouds  

Cloud Foundry open PaaS - Choice of clouds

Page 21: Cloudfoundry architecture

Cloud Foundry Architecture

Page 22: Cloudfoundry architecture

•  No single point of failure •  Distributed state •  Self healing •  Horizontally scalable

Architectural Goals

Page 23: Cloudfoundry architecture

•  Loose coupling •  Event-driven •  Asynchronous •  Non-blocking •  Idempotent •  Eventually consistent •  Language-independent communication

Architectural Principles

Page 24: Cloudfoundry architecture

Cloud Foundry Layers

Hardware (CPU, Memory, Storage, Network)

Infrastructure as a Service

Outer Shell

Inner Shell

Clients

Page 25: Cloudfoundry architecture

Cloud Foundry Core Components The Inner Shell

Page 26: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 27: Cloudfoundry architecture

Zooming in…

© 2012 VMware, Inc. All rights reserved

staging jobs

redis

cc - db

cloud controller stager

package cache

blobstore

uaa - db dea

health manager

staging logs uaa - AuthN

App meta data

dea dea dea dea dea

Page 28: Cloudfoundry architecture

•  Dynamically discoverable components •  No inter-component dependencies

–  Launch in any order –  Scale up and down independently

•  Monitor using HTTP end points

Design Principles

Page 29: Cloudfoundry architecture
Page 30: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 31: Cloudfoundry architecture

•  Interface with the clients –  VMC –  STS –  Portal

•  Provides REST interface to domain objects –  Apps –  Services –  Orgs –  Spaces

Cloud Controller

Page 32: Cloudfoundry architecture

Demo

Cloud Controller REST API

Page 33: Cloudfoundry architecture
Page 34: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 35: Cloudfoundry architecture

•  Responsible for morphing user app into executable •  Pluggable architecture

–  Each plugin understands a framework or a runtime •  Allow the DEA to view applications uniformly

Stager

Page 36: Cloudfoundry architecture

Stager’s role

Spring Play Rails …

……………………………………………………………………………..

Stager ……………………………………………………………………………… ::::::::::

Page 37: Cloudfoundry architecture

app.war

From bits to executable app

Page 38: Cloudfoundry architecture

app.war

From bits to executable app

Page 39: Cloudfoundry architecture

app.war

From bits to executable app

Page 40: Cloudfoundry architecture

app.war

startup

stop

From bits to executable app

Page 41: Cloudfoundry architecture
Page 42: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager

Messaging

Users Developers

Stagers

Services

Page 43: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 44: Cloudfoundry architecture

app.war

startup

stop

From bits to running app

Page 45: Cloudfoundry architecture

app.war

startup

stop

From bits to running app

Page 46: Cloudfoundry architecture

app.war

startup

stop

A g e n t

From bits to running app

Page 47: Cloudfoundry architecture

app.war

startup

stop

A g e n t

From bits to running app

Page 48: Cloudfoundry architecture

•  Responsible for running all apps •  Monitors apps

–  Memory and disk quota –  Stage changes

•  Uniform view of all apps –  Runtime/framework differences sorted by the stager

•  Ensures app isolation

Droplet Execution Agent (DEA)

Page 49: Cloudfoundry architecture

Application Isolation

Warden container

Private network

App

Private File System

Host network

DEA Container API

Page 50: Cloudfoundry architecture
Page 51: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 52: Cloudfoundry architecture

•  Responsible to route requests to –  User apps –  External-facing components

•  Cloud Controller •  UAA

Router

Page 53: Cloudfoundry architecture

Application Routing

Messaging

Page 54: Cloudfoundry architecture

Router

Application Routing

Messaging

Page 55: Cloudfoundry architecture

Router

Application Routing

Messaging

DEA url è host:port

Page 56: Cloudfoundry architecture

Router

Application Routing HTTP

Messaging

DEA url è host:port

Page 57: Cloudfoundry architecture

Router

Application Routing HTTP

Locator Services

Nginx (+Lua extension)

Messaging

DEA url è host:port

Page 58: Cloudfoundry architecture

Router

Application Routing HTTP

Locator Services

Nginx (+Lua extension)

Messaging

DEA url è host:port

Page 59: Cloudfoundry architecture
Page 60: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

Execution Agents (DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 61: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 62: Cloudfoundry architecture

§ Expected state: •  Cloud Controller

§ Current state: •  DEAs

§ Current state ç Expected state

Health Manager

Page 63: Cloudfoundry architecture
Page 64: Cloudfoundry architecture

•  Centralized Identity Management –  Authenticates users from multiple sources –  Presents a single standard protocol for consumers

•  User Account Management •  Client Application Registration •  OpenID Connect and Oauth2 – delegated authorization

–  Uses Spring Security

UAA

Page 65: Cloudfoundry architecture

Oauth2 for Cloud Foundry

User Resource owner

UAA Identity provider

CF Portal Client

Cloud controller Resource server

Page 66: Cloudfoundry architecture

Oauth2 for Cloud Foundry

User Resource owner

UAA Identity provider

CF Portal Client

Cloud controller Resource server

Accesses the portal

Who is this user What is he/she requesting Do I have the necessary authorization

Page 67: Cloudfoundry architecture

Oauth2 for Cloud Foundry

User Resource owner

UAA Identity provider

CF Portal Client

Cloud controller Resource server

Accesses the portal

Who is this user What is he/she requesting Do I have the necessary authorization

Authenticate me Assert - Portal can only read my apps

Authenticates user Issues authorization code

Page 68: Cloudfoundry architecture

Oauth2 for Cloud Foundry

User Resource owner

UAA Identity provider

CF Portal Client

Cloud controller Resource server

Accesses the portal

Who is this user What is he/she requesting Do I have the necessary authorization

Authenticate me Assert - Portal can only read my apps

Authenticates user Issues authorization code

Redirect user along with the authcode

Page 69: Cloudfoundry architecture

Oauth2 for Cloud Foundry

User Resource owner

UAA Identity provider

CF Portal Client

Cloud controller Resource server

Accesses the portal

Who is this user What is he/she requesting Do I have the necessary authorization

Authenticate me Assert - Portal can only read my apps

Authenticates user Issues authorization code

Exchange authcode for an access token

Issue access token scoped to cloud_controller.apps.read

Redirect user along with the authcode

Page 70: Cloudfoundry architecture

Oauth2 for Cloud Foundry

User Resource owner

UAA Identity provider

CF Portal Client

Cloud controller Resource server

Accesses the portal

Who is this user What is he/she requesting Do I have the necessary authorization

Authenticate me Assert - Portal can only read my apps

Authenticates user Issues authorization code

Exchange authcode for an access token

Present token containing cloud_controller.apps.read

Issue access token scoped to cloud_controller.apps.read

Redirect user along with the authcode

Page 71: Cloudfoundry architecture
Page 72: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Page 73: Cloudfoundry architecture

Cloud Foundry Inner Shell and Up

Routers

CloudControllers App App

HealthManager Execution Agents

(DEA) Pool

Messaging

Users Developers

Stagers

Services

Page 74: Cloudfoundry architecture

•  Service Gateway –  Provisions and unprovisions services –  Advertise service availability to CloudController

•  Service Nodes –  Runs actual services –  Scale independently

Service Provisioning

Page 75: Cloudfoundry architecture

Access to services info VCAP_SERVICES: {! "postgresql-9.0": [{! "name": "env-postgresql",! "label": "postgresql-9.0",! "plan": "free",! "credentials": {! "name": "de24667f9344b4eeaad6b5a2326d52faa",! "host": "172.30.48.122",! "port": 5432,! "user": "u50ce600bba434bacbc99e034bb415644",! "password": "pf4dca5bd449d4732841f0c4ae3f299d0"! }! }]!}!

Page 76: Cloudfoundry architecture

Operating Cloud Foundry The Outer Shell

Page 77: Cloudfoundry architecture

§  500 – 5,000 VMs §  40+ unique node types §  75+ unique software packages §  2x/week cf.com updates §  24x7x365 non-stop operation §  No-downtime deployments §  Reliable, robust, repeatable

deployments, updates, capacity adjustments

§  Small teams manage many instances

Production Grade Cloud Foundry Clusters

production, staging, stress, qa, dev

cloudfoundry.com

Page 78: Cloudfoundry architecture

Service Evolution Technology for Operating Cloud Foundry in Production Environments

Automated Virtual Infrastructure •  At Cloud Scale •  Abstracted using a Cloud Provider Interface (CPI) Software Deployment, Configuration and Updates •  Optimized to Minimize Downtime •  Support for multiple VM roles Repeatable Process •  Release Management with Versioning Active Monitoring and Alerting BOSH has been used to run CloudFoundry.com since launch

What is BOSH? github.com/cloudfoundry/bosh

Page 79: Cloudfoundry architecture

Cloud Foundry “BOSH” – Concepts

"BOSH"

Page 80: Cloudfoundry architecture

Cloud Foundry “BOSH” – Concepts Stemcell • Base OS • “BOSH” Agent

"BOSH"

Page 81: Cloudfoundry architecture

Cloud Foundry “BOSH” – Concepts Stemcell • Base OS • “BOSH” Agent

Release • Name Jobs • Software Packages • Configuration Templates • Scripts

Software Packages • Externally developed s/w • Internally developed s/w

"BOSH"

Page 82: Cloudfoundry architecture

Cloud Foundry “BOSH” – Concepts Stemcell • Base OS • “BOSH” Agent

Deployment Manifest • Release name and version • # VMs, params for each Job • Stemcells to use

Release • Name Jobs • Software Packages • Configuration Templates • Scripts

Software Packages • Externally developed s/w • Internally developed s/w

"BOSH"

Page 83: Cloudfoundry architecture

Cloud Foundry “BOSH” – Concepts Stemcell • Base OS • “BOSH” Agent

Deployment Manifest • Release name and version • # VMs, params for each Job • Stemcells to use

Release • Name Jobs • Software Packages • Configuration Templates • Scripts

Software Packages • Externally developed s/w • Internally developed s/w

"BOSH"

Page 84: Cloudfoundry architecture

Cloud Foundry “BOSH” – Concepts

Environment

Stemcell Software Packages

Configuration

Stemcell • Base OS • “BOSH” Agent

Deployment Manifest • Release name and version • # VMs, params for each Job • Stemcells to use

Release • Name Jobs • Software Packages • Configuration Templates • Scripts

Software Packages • Externally developed s/w • Internally developed s/w

"BOSH"

Page 85: Cloudfoundry architecture

Rolling Update of a Stateless Component

Message Bus

Cloud Controller

v1

Starting with v1 VMs

Router

Incoming HTTP Requests

Message Bus

Cloud Controller

v1

Cloud Controller

v2

Deploy a v2 VM (canary)

Create

Router

Incoming HTTP Requests

Message Bus

Cloud Controller

v1

Cloud Controller

v2

If it works, add more v2 VMs...

Create

Router

Incoming HTTP Requests

Page 86: Cloudfoundry architecture

Example: Rolling Update of a Stateless Component

End Result: We upgraded from v1 to v2 with no downtime by building new VMs and destroying old ones

Message Bus

Cloud Controller

v1

Cloud Controller

v2

… while removing v1 VMs…

Create Destroy

Router / LB Incoming HTTP Requests

Message Bus

Cloud Controller

v2

… until all VMs are v2

Router / LB Incoming HTTP Requests

Page 87: Cloudfoundry architecture

§ Parallel § Canaries § Eventual consistency

Deployment

Page 88: Cloudfoundry architecture

§ Components •  Director •  Agent •  CLI

§ Stemcell

Under the Hood

Page 89: Cloudfoundry architecture

Code Change

Page 90: Cloudfoundry architecture

VM Update

Page 91: Cloudfoundry architecture

VM Update

Page 92: Cloudfoundry architecture

Cloud Provider Interface •  Abstracts infrastructure

–  Stemcells •  VM template

–  VMs –  Disks –  Networks

Page 93: Cloudfoundry architecture

IaaS neutral by design

CPI: code complete functional status: “work in progress”

vSphere: battle tested implementation, thousands of deployments vCloud Director: “work in progress”, 2H 2012

contribute: github.com/cloudfoundry/bosh

Cloud Provider Interface (CPI)

Cloud Foundry BOSH

Page 94: Cloudfoundry architecture

CPI Providers

Page 95: Cloudfoundry architecture

Twitter •  http://twitter.com/cloudfoundry •  http://twitter.com/ramnivas

Sign up online at cloudfoundry.com •  Website: http://cloudfoundry.org •  Blog: http://blog.cloudfoundry.com and http://blog.cloudfoundry.org •  GitHub: http://github.com/cloudfoundry •  YouTube: http://youtube.com/cloudfoundry

Learn More. Stay Connected.

Page 96: Cloudfoundry architecture

Questions?

Page 97: Cloudfoundry architecture

Cloud Foundry Architecture Ramnivas Laddad

@ramnivas

© 2012 SpringOne 2GX. All rights reserved. Do not distribute without permission.