cloud foundry the open paas - opentour austin keynote
TRANSCRIPT
Cloud FoundryThe Open Platform as a Service
Patrick ChanezonSenior DirectorDeveloper [email protected]://twitter.com/chanezon Cloud Foundry OpenTour, Austin, April 2012Thursday, April 5, 12
P@ in a nutshell
• French, based in San Francisco
• Senior Director, Developer Relations, VMware
• Software Plumber, API guy, mix of Enterprise and Consumer
• 18 years writing software, backend guy with a taste for javascript
• 2 y Accenture (Notes guru), 3 y Netscape/AOL (Servers, Portals), 5 y Sun (ecommerce, blogs, Portals, feeds, open source)
• 6 years at Google, API guy (first hired, helped start the team)
• Adwords, Checkout, Social, HTML5, Cloud
Thursday, April 5, 12
Dreams Of my childhood
3
Thursday, April 5, 12
Accelerando / Singularity, in a Galaxy far far away
§ Even if we automate ourselves out of a job every 10 years
§ ...I don’t think the singularity is near!
4
Thursday, April 5, 12
Moore's Law is for Hardware Only
§ Does not apply to software
§ Productivity gains not keeping up with hardware and bandwidth
§ Writing software is hard, painful, and still very much a craft
5
Thursday, April 5, 12
Moore's Law’s free lunch is over
§ Herb Sutter, Welcome to the Junglehttp://herbsutter.com/welcome-to-the-jungle/
6
Thursday, April 5, 12
Future
“The future is already here — it's just not very evenly distributed” William Gibson
7
Thursday, April 5, 12
Haiku - Skylark
“Trampling on clouds,inhaling the mist,the skylark soars” —SHIKI
8
Thursday, April 5, 12
Haiku - Frog
“Crouching,studying the clouds—a frog”CHIYO-JO
9
Thursday, April 5, 12
Architecture Changes: 60’s Mainframe
Thursday, April 5, 12
Architecture Changes: 80’s Client-Server
Thursday, April 5, 12
Architecture Changes: 90’s Web
Thursday, April 5, 12
Architecture Changes: 2010’s Cloud, HTML5, Mobile
Thursday, April 5, 12
Back to Client Server: Groovy Baby!
14
Thursday, April 5, 12
What is Cloud Computing?
15
Cloud According to my daughter Eliette
Thursday, April 5, 12
Cloud Stack - Classic Pyramid
16
Platform As A Service
Infrastructure As A Service
SoftwareAs A Service
Thursday, April 5, 12
Cloud Stack - By Number
17
Platform As A Service
InfrastructureAs A Service
SoftwareAs A Service
Thursday, April 5, 12
Cloud Stack - By Value
18
InfrastructureAs A Service
SoftwareAs A Service
Platform As A Service
Thursday, April 5, 12
Cloud Stack - Neutral
19
Platform As A Service
Infrastructure As A Service
SoftwareAs A Service
Thursday, April 5, 12
Cloud Stack - History
§ What does cloud mean, 4 main angles• Software 1994 Netscape
• Infrastructure 2002 Amazon AWS
• Platform 2008 Google
• Development now!
20
§ Industrialization of hardware and software infrastructurelike electricity beginning of 20th century
§ But software development itself is moving towards craftmanship
Thursday, April 5, 12
Cloud started at Consumer websites solving their needs
• Google, Amazon, Yahoo, Facebook, Twitter
• Large Data Sets
• Storage Capacity growing faster than Moore’s Law
• Fast Networks
• Horizontal -> Vertical scalability
• Open Source Software
• Virtualization
• Cloud is a productization of these infrastructures
• Public Clouds Services: Google, Amazon
• Open Source Software: Hadoop, Eucalyptus, Ubuntu, Cloud Foundry
Thursday, April 5, 12
22
Infrastructure
Thursday, April 5, 12
IaaS/Virtualization getting mainstream
§ AWS, Joyent, Rackspace,...
§ Open Source projects: OpenStack, DeltaCloud, Eucalyptus
§ Automation: Chef, Juju
§ Standardization? DMTF
§ Inside the Firewall, Virtualization: VMware, Microsoft, Xen, KVM
§ 50% of workloads are virtualized
§ Easy to provision, manage instance...BUT
§ Still need to manage backups, software stacks, monitor, upgrades
23
Thursday, April 5, 12
With Infrastructure, you still need to build your own platform
§ Need to build a distributed platform on top of you infrastructure
§ Story of the AWS meltdown from last summer• http://blog.reddit.com/2011/03/why-reddit-was-down-for-6-of-last-24.html
• http://www.readwriteweb.com/cloud/2010/12/chaos-monkey-how-netflix-uses.php
• http://news.ycombinator.com/item?id=2477296
• http://stu.mp/2011/04/the-cloud-is-not-a-silver-bullet.html
§ Twilio, Smugmug, SimpleGeo survived it because they built their own distributed platform on top of IaaS
§ Enterprise customers want to consider Infrastructure like CDNs• Multi Cloud usage
• Based on Open Source de facto standards, or full standards whenever that happens
24
Thursday, April 5, 12
25
Platforms
Thursday, April 5, 12
Platforms
§ Raise the Unit of currency to be application & services instead of infrastructure
§ Google App Engine, Cloud Foundry, Joyent, Heroku, Stax (Cloudbees), Amazon elastic beanstalk, Microsoft Azure, AppFog
§ Single or a few languages, services
§ Start of Multi language Polyglot platforms
§ Enabler for Agile Developers -> Create Business value faster
§ Lack of standards: risk, vendor lock-in
§ Enterprise needs:•Control, customizability
•Private/Hybrid Cloud
•Avoid lock-in
26
Thursday, April 5, 12
Agile Development Processes
Thursday, April 5, 12
Agility as a survival skill
§ Consumer software is becoming like fashion•Phone apps, social apps, short lifetime, fast lifecycles
•Ab testing
§ Clay shirky situational apps
§ Kent Beck, Usenix 2011 Talk, “Software G-Forces”change in software process when frequency grows
§ Cloud Platforms enables an Agile culture, driver for innovation•Scalability is built in the platforms
•Can iterate faster
•Focus on design
§ Cloud Platforms lets developers focus on driving business value
28
Thursday, April 5, 12
Main Risk: Lock-In
29
Welcome to the hotel californiaSuch a lovely placeSuch a lovely facePlenty of room at the hotel californiaAny time of year, you can find it here
Last thing I remember, I wasRunning for the doorI had to find the passage backTo the place I was before’relax,’ said the night man,We are programmed to receive.You can checkout any time you like,But you can never leave!
Thursday, April 5, 12
Cloud Foundry: The Open PaaS
30
Clou
d Pr
ovide
r Int
erfa
ce
Application Service Private Clouds
PublicCloud
MicroCloud
Data Services
Other Services
Msg Services
vFabric Postgres
vFabric RabbitMQTM
• Open Source: Apache 2 Licensed
• multi language/frameworks
• multi services
• multi cloud
Thursday, April 5, 12
31
Open Source
Thursday, April 5, 12
Open Source Advantage
§ http://code.google.com/p/googleappengine/issues/detail?id=13
32
• https://github.com/cloudfoundry/vcap/pull/25
Thursday, April 5, 12
33
Multi Cloud
Thursday, April 5, 12
34
CloudFoundry.COM
Runtimes & Frameworks
Services
vCenter / vSphere
Cloud Foundry
Infrastructure
Thursday, April 5, 12
35
Cloud Foundry.ORG
The Source Code to Compile & Build Cloud Foundry
vCenter / vSphere
Cloud Foundry
DownloadCode
Setup Environment
Deploy Behind Firewall
Setup Scripts
Thursday, April 5, 12
Micro Cloud Foundry
36
Micro
Thursday, April 5, 12
What is a Micro Cloud?
37
Entire Cloud Running inside of a single VM
Or
Thursday, April 5, 12
Micro Cloud Foundry… (BETA)
38
A pre-built Micro (Single VM) version of Cloud Foundry…
Signup @ http://cloudfoundry.com/micro
You need a Cloud Foundry.com Account to use Micro Cloud Foundry
Thursday, April 5, 12
Micro Cloud Foundry… (BETA)
38
A pre-built Micro (Single VM) version of Cloud Foundry…
Signup @ http://cloudfoundry.com/micro
You need a Cloud Foundry.com Account to use Micro Cloud Foundry
Micro
Thursday, April 5, 12
What is in Micro Cloud Foundry?
39
Open source Platform as a Service project
App Instances Services
10.04
Dynamic Updating DNS
.COM
Thursday, April 5, 12
Other Cloud Foundry powered PaaS
40
Private PaaS
Added Python and Perl
Public PaaS
Added PHP
Tier3 and Uhuru recently added .NET support
Thursday, April 5, 12
41
Development LifeCycle
Thursday, April 5, 12
Traditional App Deploy and Request/Response
Web
App
DB
Web
App
DB
Request/AllocateBuild/SetupInstall/ConfigureDeploy/Test
Scale?Upgrade?Update?
Thursday, April 5, 12
Web
How Apps are Deployed on Cloud Foundry
Web
App
DB
“vmc push MyApp”
WebApp
DB
“vmc instances MyApp 5”“vmc map MyApp MyApp2”“vmc update MyApp”
Scale?Upgrade?Update?
Thursday, April 5, 12
Web
How Apps are Deployed on Cloud Foundry
Web
App
DB
“vmc push MyApp”
WebApp
DB
“vmc instances MyApp 5”“vmc map MyApp MyApp2”“vmc update MyApp”
Scale?Upgrade?Update?
Thursday, April 5, 12
How Apps are Accessed on Cloud Foundry
Web
App
DB
App Instance
Service
Request Web InterfaceLoad
Balancingand
Routing
Response
“vmc push MyApp”
Thursday, April 5, 12
How Apps are Scaled on Cloud Foundry
Web
App
DB
App Instances
Service
Request
Response
Load
Balancer(s)Load
Balancer(s)
Load Balancing
and Routing
Web
App
Web
App
“vmc instances MyApp 3”
Thursday, April 5, 12
How Apps are Updated on Cloud Foundry
Web
App
DB
Service
Web
App
DB
Service
Web
App
Web
App
PreviousVersion
InstanceStopped
UpdatedCode
NewVersion
“vmc update MyApp”
Thursday, April 5, 12
47
Services
Thursday, April 5, 12
Current Services Available on Cloud Foundry
48
Thursday, April 5, 12
Service Creation and Binding
49
VCAP_SERVICES:
{"redis-2.2":[{"name":"redis_sample","label":"redis-2.2","plan":"free",
"tags":["redis","redis-2.2","key-value","nosql"],
"credentials":
{"hostname":"172.30.48.40",
"host":"172.30.48.40",
"port":5023,
"password":"8e9a901f-987d-4544-9a9e-ab0c143b5142",
"name":"de82c4bb-bd08-46c0-a850-af6534f71ca3"}
}],
"mongodb-1.8":[{"name":"mongodb-e7d29","label":"mongodb-1.8","plan":"free","tags”:………………….
Thursday, April 5, 12
Service Creation and Binding
50
App Instance
Thursday, April 5, 12
Service Creation and Binding
50
App Instance Redis Service
Thursday, April 5, 12
Service Creation and Binding
50
App Instance Redis Service
Thursday, April 5, 12
Service Creation and Binding
50
App Instance Redis Service
MongoDB
Service
Thursday, April 5, 12
51
How it works
Thursday, April 5, 12
Logical View
52
VMC client STS plugin Browser(user app access)
Routers
CloudControllers App
Services
App
HealthManager
DEA Pool
Messaging
Thursday, April 5, 12
53
Architecture
Thursday, April 5, 12
Register today
54
http://cloudfoundry.com/signup
CFOpenTour2012Use Promo Code
To avoid approval queue waiting time
Thursday, April 5, 12
Cloud for Developers: the true path is PaaS!
55
Thursday, April 5, 12
developer perspective v2.0
sample app
polyglot in actionby Mark Lucovsky
56
Thursday, April 5, 12
developer perspective v2.057
Thursday, April 5, 12
developer perspective v2.0
stac2: load generation system
58
redis
stac2frontend
api server
vmc worker http worker
http json
redis apirpush
blpop blpopredis api
- 2 x 128mb- ruby 1.8.7, sinatra
- 16 x 128mb*- node.JS, 0.6.8
- 16 x 128mb*- node.JS, 0.6.8
- 96 x 128mb- ruby 1.8.7, sinatra
json-p- jQuery, jQuery UI- haml templates- 100% JS based UI
* - api server and http worker share the same node.JS process/instance
emailreports
smtp
Thursday, April 5, 12
developer perspective v2.0
deployment instructions
59
$ cd ~/stac2$ vmc push
Thursday, April 5, 12
developer perspective v2.0
how is this possible?$ cd ~/stac2; cat manifest.ymlapplications: ./nabh: instances: 16 mem: 128M runtime: node06 url: ${name}.${target-‐base} services: nab-‐redis: type: :redis./nabv: instances: 96 mem: 128M runtime: ruby18 url: ${name}.${target-‐base} services: nab-‐redis: type: :redis./stac2: instances: 2 mem: 128M runtime: ruby18 url: ${name}.${target-‐base}
60
Thursday, April 5, 12
developer perspective v2.0
design tidbits
61
• producer/consumer pattern using rpush/blpop
• node.JS: multi-server and high performance async i/o
• caldecott – aka vmc tunnel for debugging
• redis sorted sets for stats collection
• redis expiring keys for rate calculation
Thursday, April 5, 12
developer perspective v2.0
producer/consumer
• core design pattern
• found at the heart of many complex apps
62
classic mode:- thread pools- semaphore/mutex, completion ports, etc.- scalability limited to visibility of the work queue
consumerwork queueproducer work work
cloud foundry mode:- instance pools- redis rpush/blpop, rabbit queues, etc.- full horizontal scalability, cloud scale
Thursday, April 5, 12
developer perspective v2.0
producer/consumer: code
63
// producerfunction commit_item(queue, item) { // push the work item onto the proper queue redis.rpush(queue, item, function(err, data) {
// optionally trim the queue, throwing away // data as needed to ensure the queue does // not grow unbounded if (!err && data > queueTrim) { redis.ltrim(queue, 0, queueTrim-‐1); } });}
// consumerfunction worker() { // blocking wait for workitems blpop_redis.blpop(queue, 0, function(err, data) { // data[0] == queue, data[1] == item if (!err) { doWork(data[1]); } process.nextTick(worker); });
Thursday, April 5, 12
developer perspective v2.0
node.JS multi-server: http API server
64
// the api server handles two key load generation apis// /http – for http load, /vmc for Cloud Foundry API loadvar routes = {“/http”: httpCmd, “/vmc”: vmcCmd}
// http api server booted by app.js, passing redis client// and Cloud Foundry instance function boot(redis_client, cfinstance) { var redis = redis_client; function onRequest(request, response) { var u = url.parse(request.url); var path = u.pathname; if (routes[path] && typeof routes[path] == ‘function’) { routes[path](request, response); } else { response.writeHead(404, {‘Content-‐Type’: ‘text/plain’}); response.write(‘404 Not Found’); response.end(); } } server = http.createServer(onRequest).listen(cfinstance[‘port’]);}
Thursday, April 5, 12
developer perspective v2.0
node.JS multi-server: blpop server
65
var blpop_redis = null;var status_redis = null;var cfinstance = null;
// blpop server handles work requests for http traffic// that are placed on the queue by the http API server// another blpop server sits in the ruby/sinatra VMC serverfunction boot(r1, r2, cfi) { // multiple redis clients due to concurrency constraints blpop_redis = r1; status_redis = r2; cfinstance = cfi; worker();}
// this is the blpop server loopfunction worker() { blpop_redis.blpop(queue, 0, function(err, data) { if (!err) { doWork(data[1]); } process.nextTick(worker); });}
Thursday, April 5, 12
developer perspective v2.0
caldecott: aka vmc tunnel
66
# create a caldecott tunnel to the redis server$ vmc tunnel nab-‐redis redis-‐cliBinding Service [nab-‐redis]: OK…Launching 'redis-‐cli -‐h localhost -‐p 10000 -‐a ...’
# enumerate the keys used by stac2redis> keys vmc::staging::*1) “vmc::staging::actions::time_50”2) “vmc::staging::active_workers”…
# enumerate actions that took less that 50msredis> zrange vmc::staging::actions::time_50 0 -‐1 withscores1) “delete_app”2) “1”3) “login”4) “58676”5) “info”6) “80390”
# see how many work items we dumped due to concurrency constraintredis> get vmc::staging::wastegate“7829”
Thursday, April 5, 12
developer perspective v2.0
redis sorted sets for stats collection
67
# log action into a sorted set, net result is set contains# actions and the number of times the action was executed# count total action count, and also per elapsed time bucketdef logAction(action, elapsedTimeBucket) # actionKey is the set for all counts # etKey is the set for a particular time bucket e.g., _1s, _50ms actionKey = “vmc::#{@cloud}::actions::action_set” etKey = “vmc::#{@cloud}::actions::times#{elapsedTimeBucket}” @redis.zincrby actionKey, 1, action @redis.zincrby etKey, 1, actionend
# enumerate actions and their associated countredis> zrange vmc::staging::actions::action_set 0 -‐1 withscores1) “login”2) “212092”3) “info”4) “212093”
# enumerate actions that took between 400ms and 1sredis> zrange vmc::staging::actions::time_400_1s 0 -‐1 withscores1) “create-‐app”2) “14”3) “bind-‐service”4) “75”
Thursday, April 5, 12
developer perspective v2.0
redis incrby and expire for rate calcs
68
# to calculate rates (e.g., 4,000 requests per second)# we use plain old redis.incrby. the trick is that the # key contains the current 1sec timestamp as it’s suffix value# all activity that happens within this 1s period accumulates# in that key. by setting an expire on the key, the key is # automatically deleted 10s after last writedef logActionRate(cloud) tv = Time.now.tv_sec one_s_key = "vmc::#{cloud}::rate_1s::#{tv}"
# increment the bucket and set expires, key # will eventually expires Ns after the last write @redis.incrby one_s_key, 1 @redis.expire one_s_key, 10end
# return current rate by looking at the bucket for the previous # one second period. by looking further back and averaging, we # can smooth the rate calcdef actionRate(cloud) tv = Time.now.tv_sec -‐ 1 one_s_key = "vmc::#{cloud}::rate_1s::#{tv}" @redis.get one_s_keyend
Thursday, April 5, 12
developer perspective v2.0
stac2 demo -or- screencast
69
Thursday, April 5, 12
developer perspective v2.0
stac2 demo -or- screencast
69
Thursday, April 5, 12
70
Lessons for Developers
Thursday, April 5, 12
Predictions
§ Software is becoming like fashion, design rules
§ Welcome to Babel, use the best tool for the job, embrace multiple language & heterogeneity
§ Our jobs will change, build yourself out of your current job
§ Sysadmin jobs will morph, there will be less of them
§ Many opportunities open when you embrace change
71
Thursday, April 5, 12
Things to Forget
§ First normal form
§ Waterfall model
§ Single server deployment
§ Single language skill
§ Build everything from scratch
§ Build custom infrastructure
72
Thursday, April 5, 12
Things to Learn
• Agile, API Design
• UI Design, Javacript, HTML5, CSS3
• A/B Testing
• Open Source, Open Standards
• Architecture, Distributed Computing (CAP theorem, 8 fallacies)
• Cloud Platforms and APIs
• Multiple types of languages (imperative, object, functional, logic)
• Ability to encapsulate domain knowledge in a DSL
• Build on the shoulders of giants: reuse, rest APIs
• Pick your battles, choose what you need to build yourself to add value
• Learn to live in a box (embrace platform limitations) to think outside the box
• Use an App Store for distribution
73
Thursday, April 5, 12
Be your own bitch
“Don’t be a Google Bitch, don’t be a Facebook Bitch, and Don’t be a Twitter Bitch. Be your own Bitch.”Fred Wilson
74
http://techcrunch.com/2011/05/23/fred-wilson-be-your-own-bitch/
Thursday, April 5, 12
Such stuff as dreams are made on
§ Like a kid on a candy store: there's never been a better time to be a software developer!
§ Welcome to the Cloud: embrace change and reinvent yourselves
§ “The future is already there, not evenly distributed” Gibson
§ We Developers, invent the future today
75
Thursday, April 5, 12
Cloud Foundry Resources
76
Primary Site : cloudfoundry.com
Open Source Site : cloudfoundry.org
Twitter : @cloudfoundry , hash tag #cfoundry
Blog : blog.cloudfoundry.com
FB : facebook.com/cloudfoundry
Support : support.cloudfoundry.com• Documentation
• Knowledge Base
• Q & A / Forums
We’re hiring: www.cloudfoundry.com/jobs
Thursday, April 5, 12
Questions
77
?Thursday, April 5, 12
Thank You!@CloudFoundry
@chanezon
Website : www.cloudfoundry.comBlog : blog.cloudfoundry.comForum : support.cloudfoundry.com
t
t
Thursday, April 5, 12
Books / Articles
§ Nick Carr, The Big Switch
§ Eric Raymond, The Art of Unix Programming
§ Weinberg, Psychology of Computer Programming
§ Wes python book
§ Mark html5 book
§ Kent Beck XP
§ Hunt, Thomas, The Pragmatic Programmer
§ Ade Oshineye, Apprenticeship Patterns
§ Matt Cutt's Ignite Talk IO 2011, Trying different things
§ Josh Bloch talk about api design
§ Larry and Sergey, Anatomy of a Search Engine
§ Rob Pike, The Practice of Programming
79
Thursday, April 5, 12
Papers / Talks
§ Simon Wardley, Oscon 09 “Cloud - Why IT Matters”
§ Tim O’Reilly article on internet os
§ Peter Deutsch’s 8 Fallacies of Distributed Computing
§ Brewer’s CAP Theorem
§ Gregor Hohpe’s Starbucks Does Not Use Two-Phase Commit
§ Stuff I tag http://www.delicious.com/chanezon/
§ More specifically http://www.delicious.com/chanezon/cloudfoundry
§ My previous Talks http://www.slideshare.net/chanezon
§ My list of favorite books http://www.chanezon.com/pat/soft_books.html
80
Thursday, April 5, 12
Acknowledgement
§ Drawings from my daughters Eliette
§ Slides from Dave McCrory, Derek Collison, Duke Leto
§ Haiku from Addiss, Stephen; Yamamoto, Fumiko; Yamamoto, Fumiko Y.; Yamamoto, Akira Y. (2011-06-22). Haiku: An Anthology of Japanese Poems (Shambhala Library)
§ Painting Hiroshige, Sengai
81
Thursday, April 5, 12