Upload
carlos-santana
View
102
Download
3
Embed Size (px)
Citation preview
@csantanapr
What you will learn
• How cloud computing has recently evolved to enable developers to write cloud native applications better, faster, and cheaper using serverless technology.
• How OpenWhisk provides an open source platform to enable cloud native, serverless, event driven applications.
@csantanapr
Sometimes Servers let us down
• HARD DRIVE FAILS• LINUX OS VULNERABILTY• MIDDLEWARE VERSION UPDATE• MORE MEMORY AND BIGGER CPU• ….
@csantanapr
Scaling takes effort
Explosion in number of containers / processes:
1. Increase of infrastructure cost footprint
2. Increase of operational management cost and complexity
Region BRegion A
Break-down into microservices
Make each micro service HA
Protect against regional outages
Monolithic application
@csantanapr
Utilization
Average Utilization20% - 40%of capacity
@csantanapr
Cloud Evolution
Bare metal
Virtual machines
Containers
PaaSFunctions
Decreasing concern (and control) over stack implementation
Incr
easi
ng fo
cus
on b
usin
ess
logi
c
@csantanapr
Function-as-a-Service
@csantanapr
SCALING: 0 to N
@csantanapr
Pay as you go
@csantanapr
Plenty of Providers
@csantanapr
Compute Limits
flickr photo by zund https://flickr.com/photos/zund/12202485675 CC (BY-NC-ND) license
@csantanapr
Debug/Test/Monitor
flickr photo by Thomas Hawk https://flickr.com/photos/thomashawk/4544013443 CC (BY-NC) license
@csantanapr
Deployment Complexity
@csantanapr
Frameworks
@csantanapr
Isn’t this Paas?
@csantanapr
OpenWhisk
OpenWhisk is a cloud platform that executes code
in response to events
OpenWhisk
@csantanapr
OpenWhisk Use CasesServerless Web Application
Serverless Mobile Backend
Real-time data processing
Real-time Chatbot messaging
Scheduled Jobs
@csantanapr
OpenWhisk = open source
@csantanapr
Running locally
$ git clone github.com/openwhisk/openwhisk
$ cd openwhisk/tools/vagrant
$ ./hello
@csantanapr
IBM Bluemix OpenWhisk
@csantanapr
Programming Model
A Action:
A stateless, relatively short-running function invoked as an event handler.
AJSON Object JSON Object
Input OutputStateless Function
@csantanapr
Programming Model
A function main(params) { console.log(“Hello “ + params.name); return { msg: “Goodbye “ + params.name) };}
OpenWhisk supports Node.js 6
@csantanapr
Programming Model
:=
A Action Sequence:
An Action that is a sequenced composition of 2 or more existing Actions.
Note: This composition technique allows the reuse of existing action implementations treating them as “building blocks” for other Actions.
@csantanapr
Programming Model
24
Trigger:
Note: In a pub-sub system, a trigger could be viewed as a message topic.
The name for a class of events. Triggers represent the events (and their data) themselves without any concept of how they were generated.
OpenWhiskServerlessPlatform
@csantanapr
Programming Model
R Rule:
T ATrigger(Event)
Action(Event handler)
Rule(conditional logic)
A mapping from a Trigger to an Action which may contain simple conditional logic.
Note: OpenWhisk evaluates incoming events (that belong to a Trigger) and invokes the assigned Action (event handler) associated by the Rule.
@csantanapr
Execution Model
Pool of actions
Swift DockerJS
Trigger1
Running action
Running action
Running action
3
OpenWhisk Engine
2 A
T
AAA
@csantanapr
Event Driven
Event Providers
Cloudant
GitHub
Weather
…
Which triggers execution of
associated OpenWhisk action
2
SlackJS Swift Docke
r …
An event occurs, for example• Commit pushed to GitHub
repository • Data changed in Cloudant
1 OpenWhisk
@csantanapr
REST Microservices
Send HTTP requestHTTP GET
app.com/customers
1
Invoke OpenWhisk action get-customers
Browser
Mobile App
Web App
2
JS Swift Docker …
OpenWhisk
API Proxy
@csantanapr
Under the hood
Couch DB
Consul
Router (NGINX)
Controller
Kafka
Invoker Invoker
Docker
Executor
Executor
Docker
Java Swift
Executor
Executor
NodeJS Python
1. Router receives request to API via CLI or UI
2. Controller checks entitlement and dispatches requests to Kafka
3. Invokers pull requests from CouchDB and start execution of the action
@csantanapr
Under the hood: Deep look
bit.ly/ow-int
1. Entering the system: nginx
2. Really entering the system: Controller
3. Authentication and Authorization: CouchDB
4. Getting the action: CouchDB… again
5. Who’s there to invoke the action: Consul
6. Please form a line: Kafka
7. Actually invoking the code already: Invoker
8. Storing the results: Yes… CouchDB again
@csantanapr
Slack Bot
bit.ly/ow-demo-2GET /register
POST /command
POST /event
Register action
Event action
Command action
2
OpenWhisk Engine
1
AAA
API Proxy
Register the bot
Respond to direct messages
Respond to slash commands
@csantanapr
Smart home IoT, Banking
github.com/openwhisk/awesome-openwhisk
Project OpenFridge: Improving customer service with event driven IoT
Project OpenChecks: Mobile check deposit with optical character recognition
@csantanapr
DarkVision
https://github.com/IBM-Bluemix/openwhisk-darkvisionapp
@csantanapr
Skylink
https://github.com/IBM-Bluemix/skylink
@csantanapr
Logistics Wizard
https://github.com/IBM-Bluemix/logistics-wizard
@csantanapr
Learning is Fun
• DarkVision• Skylink• Open Checks• Open Fridge• Logistic Wizard• IOT data-in-motion• Slack invite• QR Generator• Blog Nag• Just Follow You• Slack Bot• Jekyll Publisher
@csantanapr
Join Us!
github.com/openwhisk
@OpenWhisk
bluemix.net/openwhisk
slack.openwhisk.org
StackOverflow tagged =>openwhisk
Openwhisk.org