Top Banner
Introduction to Cloud Foundry for Spring & Java Developers Eric BOTTARD Developer Advocate @ebottard / [email protected]
134

LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Aug 20, 2015

Download

Technology

Eric Bottard
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: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Introduction to Cloud Foundryfor Spring amp Java Developers

Eric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Cloud Stack - Classic Pyramid

3

Softwareas a Service

Platform as a Service

Infrastructure as a Service

CONFIDENTIAL

4

Cloud Foundry ndash The Open Platform as a Service

Target a choice of deployment clouds

Provide a choice of development frameworks

Bind a choice of application

services

githubcomcloudfoundry

5

CloudFoundryCOM ndash Multi-Tenant PaaS Operated by VMware

Frameworks

Services

vCenter vSphere

CloudFoundryCOM (beta)

Infrastructure

CONFIDENTIAL

6

Micro Cloud FoundryTM ndash Cloud on a Stick

Single VM instance of Cloud Foundry that runs on a developerrsquos MAC or PC

Frameworks

Services

Micro Cloud Foundry

Your LaptopPC

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 2: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Cloud Stack - Classic Pyramid

3

Softwareas a Service

Platform as a Service

Infrastructure as a Service

CONFIDENTIAL

4

Cloud Foundry ndash The Open Platform as a Service

Target a choice of deployment clouds

Provide a choice of development frameworks

Bind a choice of application

services

githubcomcloudfoundry

5

CloudFoundryCOM ndash Multi-Tenant PaaS Operated by VMware

Frameworks

Services

vCenter vSphere

CloudFoundryCOM (beta)

Infrastructure

CONFIDENTIAL

6

Micro Cloud FoundryTM ndash Cloud on a Stick

Single VM instance of Cloud Foundry that runs on a developerrsquos MAC or PC

Frameworks

Services

Micro Cloud Foundry

Your LaptopPC

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 3: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Cloud Stack - Classic Pyramid

3

Softwareas a Service

Platform as a Service

Infrastructure as a Service

CONFIDENTIAL

4

Cloud Foundry ndash The Open Platform as a Service

Target a choice of deployment clouds

Provide a choice of development frameworks

Bind a choice of application

services

githubcomcloudfoundry

5

CloudFoundryCOM ndash Multi-Tenant PaaS Operated by VMware

Frameworks

Services

vCenter vSphere

CloudFoundryCOM (beta)

Infrastructure

CONFIDENTIAL

6

Micro Cloud FoundryTM ndash Cloud on a Stick

Single VM instance of Cloud Foundry that runs on a developerrsquos MAC or PC

Frameworks

Services

Micro Cloud Foundry

Your LaptopPC

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 4: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

4

Cloud Foundry ndash The Open Platform as a Service

Target a choice of deployment clouds

Provide a choice of development frameworks

Bind a choice of application

services

githubcomcloudfoundry

5

CloudFoundryCOM ndash Multi-Tenant PaaS Operated by VMware

Frameworks

Services

vCenter vSphere

CloudFoundryCOM (beta)

Infrastructure

CONFIDENTIAL

6

Micro Cloud FoundryTM ndash Cloud on a Stick

Single VM instance of Cloud Foundry that runs on a developerrsquos MAC or PC

Frameworks

Services

Micro Cloud Foundry

Your LaptopPC

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 5: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

5

CloudFoundryCOM ndash Multi-Tenant PaaS Operated by VMware

Frameworks

Services

vCenter vSphere

CloudFoundryCOM (beta)

Infrastructure

CONFIDENTIAL

6

Micro Cloud FoundryTM ndash Cloud on a Stick

Single VM instance of Cloud Foundry that runs on a developerrsquos MAC or PC

Frameworks

Services

Micro Cloud Foundry

Your LaptopPC

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 6: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

6

Micro Cloud FoundryTM ndash Cloud on a Stick

Single VM instance of Cloud Foundry that runs on a developerrsquos MAC or PC

Frameworks

Services

Micro Cloud Foundry

Your LaptopPC

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 7: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

7

CloudFoundryORG ndash Community Open Source Project

DownloadCode

Setup Environment

Deploy Behind Firewall

Tool Chain ampScripts

Apache2 license

Your Infrastructure

Cloud Foundry BOSH

CloudFoundryORG

Community Frameworks Contributions

Community Services Contributions

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 8: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

8

CloudFoundryORG ndash Community Open Source Project

githubcomcloudfoundry

sect NET x 2

sect PHP

sect JRuby

sect Python

sect Rails 2x

sect Clojure

sect Erlang

sect Haskell

sect Memcached

sect SQL Server

sect Neo4j

sect CouchDB

sect VirtualBox

sect Mono

sect Rack

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 9: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

Main Risk Lock In

9

Welcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 10: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

10

Cloud Foundry - Making Multi-Cloud a Reality

Public Cloud Operators

COM

Management and Deployment

Private Cloud Distributions

Bare metal

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 11: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

Cloud Foundry Clouds

11

sect Joyent

bull community lead for Nodejs

sect ActiveState

bull community lead for Python Perl

bull Providers of Stackato private PaaS

sect AppFogcom

bull community lead for PHP

bull PaaS for PHP

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 12: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Demos

12

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 13: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

VCAP_

VCAP_APP_HOST = 192168113

VCAP_APP_PORT = 58121

VCAP_SERVICES = redis-22 [ name my-redis-service label redis-22 plan free tags [ key-value nosql redis-22 redis ] credentials hostname 127001 host 127001 port 5000 password ce7b483f-66d1-436d-8aa7-7c33a9ee31ac name e740add8-24ce-40f5-94ed-8a2623e0be57 ] postgresql-90 []

13

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 14: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

Auto-reconfigurationsectWorks for Spring Node RubysectSpring Uses a BeanFactoryPostProcessor

under the hoodbulladds a jar to your appbullmodifies webxml to load the BFPPbullalso adds correct jdbc driver jar

sectOnly works if no ambiguity (80 of apps)bull One service of a kind

14

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 15: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

15

sect 500 ndash 5000 VMs

sect 40+ unique node types

sect 75+ unique software packages

sect 75+ unique environments

sect 2xweek cfcom updates

sect 24x7x365 non-stop operation

sect No-downtime deployments

sect Reliable robust repeatable deployments updates capacity adjustments

sect Small teams manage many instances

Production Grade Cloud Foundry Clusters

Google style problem egrave Google style solution

cloudfoundrycom

production staging stress qa dev

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 16: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

16

sect Cloud Foundry BOSH is an open source tool-chain for release engineering deployment and lifecycle management of large scale distributed servicesbull Prescriptive way of creating releases and managing systems and services

bull It is not a collection of shell scripts not a pile of Perl

sect Built to deploy and manage production-class large scale clustersbull Production grade Cloud Foundry clusters 500+ VMs 40+ jobs 75+ packages

bull Multi-node multi-tier complex clusters eg our GerritJenkins Cluster

sect Built for devops usage and scale by a crack team of veteransbull A project not a product command line interface YAML etc

bull Continuous improvement iterative development rough edges

Cloud Foundry BOSH

githubcomcloudfoundrybosh

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 17: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONFIDENTIAL

17

Key Takeaways

sect PaaS is the application platform for the Cloud era

sect Cloud Foundry is the Industryrsquos Open PaaSbull Developer agility

bull Portability without changes

bull Open system

sect Whatrsquos nextbull Free Signup wwwcloudfoundrycom (use ldquocloudtodayrdquo as a promocode)

bull Get started docscloudfoundrycomgetting-startedhtml

bull Learn more on the blog blogcloudfoundrycom

bull Download your Micro Cloud Foundry mycloudfoundrycommicro

bull Get the source code wwwcloudfoundryorg

bull Follow us cloudfoundry

bull Watch us wwwyoutubecomcloudfoundry

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 18: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Cloud Best PracticesEric BOTTARDDeveloper Advocateebottard ebottardvmwarecom

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 19: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Developer Advocate bull VMware

tebottardAumlericbottard

Eric Bottard

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 20: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Agenda

10 in theCLOUD

DOsDONrsquoTs

amp

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 21: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

DISCLAIMER

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 22: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CA

PTA

IN O

BVI

OU

S t-

shirt

ava

ilabl

e at

thre

adle

ssc

omD

esig

n by

Nat

han

Stilli

e an

d Jo

shua

Kem

ble

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 23: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Http TrafficLatency Matters

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 24: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Wherersquos the Data Center

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 25: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Wherersquos the Data Center

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 26: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

LEARNLots of Literature

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 27: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

DIAGNOSEChrome Dev Tools

YSlowGoogle PageSpeed

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 28: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

FIX Unique (eg hash) Paths

Far Future Expires HeaderMinification

CSS SpritesCDN

Spring ResourceHandler AbstractionWRO4J RoR Asset Pipeline

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 29: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

FileSystemJust pretend itrsquos not there

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 30: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Is your File there Is it Not

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 31: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Is your File there Is it Not

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 32: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

IT IS THEREBut

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 33: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ITrsquoS EPHEMERAL(disappears on restarts)

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 34: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ITrsquoS NOT SHAREDEither

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 35: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Use Some Persistent

STORAGE

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 36: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Use Some Persistent

STORAGEbull Mongo GridFS

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 37: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 38: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Use Some Persistent

STORAGEbull Mongo GridFSbull Database Blob

bull External Blob Service

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 39: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

StateItrsquos Better Not To Have It

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 40: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Try to be

STATELESS

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 41: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Try to be

STATELESSbull Horizontal Scaling

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 42: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Try to be

STATELESSbull Horizontal Scalingbull High Availability

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 43: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Try to be

STATELESSbull Horizontal Scalingbull High Availability

bull Zero Downtime Deploy

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 44: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 45: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 46: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 47: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 48: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

6rsquo6rdquo

6rsquo0rdquo

5rsquo6rdquo

5rsquo0rdquo

4rsquo6rdquo

4rsquo0rdquo

The Usual Suspects

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 49: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

The Usual Suspects

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 50: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

IF there is state

PUSH TO CLIENT(eg Cookie HTML5 apps)

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 51: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

IF there is state

USE CENTRAL SERVICE(eg Redis)

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 52: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

IF there is state

MAKE IT PER USER+ Sticky Sessions

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 53: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

DatabasesThey Have A Right To Evolve Too

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 54: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

vmc tunnel (caldecott)$ vmc tunnel

1 foobar-mq2 foobar-pg3 postgresql-handson-cfWhich service instancegt 3

1 none2 psqlWhich client would you like to startgt 2

Opening tunnel on port 10000

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 55: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

HUMANEQUALS(ERROR)(when they simply donrsquot forget)

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 56: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

YOUR CODE IS VERSIONEDWhy isnrsquot your DB

It is right

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 57: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

DONrsquoT ROLL YOUR OWN(and beware of clusters)

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 58: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Donrsquot Roll your Own

MIGRATIONS

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 59: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Hotel CaliforniaBetter Stay Out of It

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 60: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Main Risk Lock InWelcome to the hotel california

Such a lovely place

Such a lovely face

Plenty of room at the hotel california

Any time of year you can find it here

Last thing I remember I was

Running for the door

I had to find the passage back

To the place I was before

rsquorelaxrsquo said the night man

We are programmed to receive

You can checkout any time you like

But you can never leave

-the Eagles

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 61: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Donrsquot Code to (any) Cloud

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 62: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 63: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ltxml version=10 encoding=UTF-8gtltbeans xmlns=httpwwwspringframeworkorgschemabeansgt

ltbean id=mongoTemplate class=orgspringframeworkdatamongodbcoreMongoTemplategt

ltconstructor-arg ref=mongoDbFactory gt ltbeangt

ltbeans profile=defaultgt ltmongodb-factory id=mongoDbFactory

dbname=test host=127001 port=27017 username=foo password=bar gt

ltbeansgt

ltbeans profile=cloudgt ltcloudmongo-db-factory id=mongoDbFactory service-name=myBoundServiceName gt ltbeansgtltbeansgt

Donrsquot Code to (any) Cloudsect Auto-Reconfiguration

sect For the Last 5bull Insulate your Code

bull Leverage Frameworks eg Spring Profiles

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 64: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Beware of Data

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 65: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

SegregationAll Environments Were Created Equal

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 66: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Dev vs Test vs Staging vs Prod

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 67: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 68: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 69: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 70: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Traditional Cloud

Machines Dev ne Staging ne Prod Identical

Process Manual inconsistent Automated

People Dev ne Ops Devops

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 71: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

One app Many deploys

Build

Config

Code

Deployment

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 72: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

One app Many deploys

Build

Config

Code

Deployment

ONE set ofdeliverables

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 73: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

One app Many deploys

Build

Config

Code

Deployment

MANY deploys

ONE set ofdeliverables

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 74: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ldquoThe Twelve Factor App httpwww12factornet

Environment Variables [] unlike custom config files or other config mechanisms such as Java System Properties are a language- and OS-agnostic standard

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 75: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

S O AThis time itrsquos for real

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 76: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Do your current apps look like this

Tomcat

MySQLBrowser Apachewar

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 77: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ldquo SOA is like Adam Sandlerrsquos careerDo one thing and do it well

Rob Spectre Developer Evangelism Twilio

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 78: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Another way to look at itcut -d -f1 lt accesslog | sort | uniq -c | sort -rn | less

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 79: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Chances are they will soon look like this

MySQL

DesktopBrowser

Tomcat

userswar

Tomcat

searchwar

Tomcat

orderswar

MongoNativeMobile

App

HTML5 Mobile

App

NodejsFront End

Message Buseg RabbitMQ

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 80: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Communication

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 81: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

SYNCH vs ASYNCHeg HTTP vs AMQP

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 82: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

FORMATXML JSON PBuffers Thrift

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 83: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

LOW TECHDatabase + cron

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 84: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

When To Do It

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 85: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

EARLY ONYAGNISlows Progress

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 86: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

NOWWould be a Good Time

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 87: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

LATER ONNow You Need ItHard To Refactor

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 88: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Spring Integrationsect Pipes amp Filters Architecture

sect Promotes Loose Couplingbull Handles the Plumbing for you

sect Declarative Model

sect Internal amp External Messaging

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 89: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

DeployDo It Early amp Do It Often

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 90: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONTINUOUS INTEGRATIONAutomatic builds tests

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 91: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

CONTINUOUS DELIVERYCI + automatic deploy

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 92: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ITrsquoS OKIf itrsquos not PROD

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 93: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Automateltbuildgt ltpluginsgt ltplugingt ltgroupIdgtorgcloudfoundryltgroupIdgt ltartifactIdgtmaven-cf-pluginltartifactIdgt ltversiongt100M4-SNAPSHOTltversiongt ltconfigurationgt ltservergtmycloudfoundry-instanceltservergt lttargetgthttpapicloudfoundrycomlttargetgt ltappnamegtspring-integration-rocksltappnamegt lturlgtspring-int-rockscloudfoundrycomlturlgt ltmemorygt1024ltmemorygt ltservicesgt ltservicegt ltnamegtmysql-testltnamegt ltvendorgtmysqlltvendorgt ltservicegt ltservicegt ltnamegtmongodb-testltnamegt ltvendorgtmongodbltvendorgt ltservicegt ltservicesgt ltconfigurationgt ltplugingt ltpluginsgtltbuildgt

oplus

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 94: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

ScaleYour own Way

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 95: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Every app is

DIFFERENT

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 96: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Every app is

DIFFERENTbull CPU

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 97: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Every app is

DIFFERENTbull CPUbull RAM

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 98: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Every app is

DIFFERENTbull CPUbull RAMbull DISK

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 99: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Every app is

DIFFERENTbull CPUbull RAMbull DISKbull Bugs

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 100: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 101: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

Use system-level metrics

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 102: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

Use system-level metrics

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 103: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

Use system-level metrics

as well as

business-relatedinfo

$vmc stats myappinstance 0 cpu 00 of 2 cores memory 1916M of 512M disk 150M of 2G

httpwwwsxchuphoto1128191

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 104: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

Use Inter-process scaling

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 105: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 106: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Write your own logic

Use Inter-process scaling

$vmc scale myapp --instances 3 --memory 1G

as well as

intra-process(thread pools)

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 107: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

UpgradeWith Zero Downtime

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 108: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 109: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 110: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment$vmc app awesome awesome running platform spring on java usage 512M times 1 instance urls awesomecloudfoundrycom services postgresql-db

Users LB Proxy

Version N Version N

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 111: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 112: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 113: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment

$vmc push --name awesome_v2 --url awesome_secretcloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 114: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 115: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 116: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 117: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BlueGreen Deployment$vmc unmpap awesome awesomecloudfoundrycom$vmc map awesome_v2 awesomecloudfoundrycom

Users LB Proxy

Version N Version N

Version N+1 Version N+1

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 118: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Variations

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 119: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Variations

1Have some

(privileged) population

use N+1

CanaryRelease

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 120: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Variations

1Have some

(privileged) population

use N+1

2then roll out

CanaryRelease

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 121: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Variations

A|B Testing

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 122: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Variations

1Have some share of

the population try

a different version

A|B Testing

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 123: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Variations

1Have some share of

the population try

a different version

2then decide

A|B Testing

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 124: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

What about db changes

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 125: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

BEFORECode Version N

firstnameidPerson

lastnameaddress

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 126: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

TRANSITIONCode Version N amp N+1

firstnameidPerson

lastnameaddress

person_ididAddress

cityzipcodestreet

country

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 127: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

AFTERCode Version N+2

firstnameidPerson

lastnameperson_ididAddress

cityzipcodestreet

country

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 128: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

MIGRATIONS

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 129: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Limit your Http TrafficThere is no File System

Strive for StatelessnessAutomate your DB Migrations

Avoid Vendor Lock-inTreat all envs as Identical

Itrsquos all about Loose CouplingUse Frequent DeploymentsTargeted and Custom Scaling

Upgrade with Zero Downtime

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom

Page 130: LyonJUG - Combo - Quick Cloud Foundry Intro + Cloud Best Practices

Thank YouEric Bottard

Developer Advocate bull VMware

tebottardAumlericbottard

ebottardvmwarecom