andreas nauerz and michael behrendt - event driven and serverless programming with openwhisk
TRANSCRIPT
serverlessconf.io
IBM Bluemix OpenWhisk The Future of Cloud Programming: Event-driven and Serverless Computing with OpenWhisk Michael Behrendt, Chief Architect Bluemix Core Platform @michael_beh Dr. Andreas Nauerz, Technical Offering Manager @AndreasNauerz
Motivation & Project History
• Observation: – Early days of serverless & event-driven – Mix of business user vs. developer-focused efforts.
What are commonalities?
• Initiated project with IBM Research (programming model group) vs. product dev from day 1
2
Agenda
• Motivation & Approach • What is OpenWhisk? • Usage scenarios • OpenWhisk programming model • Demo
3
Region B Region A
Challenges with Microservices & traditional runtimes
4
Break-down into microservices
Make each micro service HA
Protect against regional outage
Explosion of # of containers / processes
à Increase of infrastructure cost footprint
à Increase of operational mgmt cost & complexity
Monolithic application Monolithic application Monolithic application Monolithic application
„Serverless, event-driven platform to execute code in response to events“
Delivered as... 1. Open Source 2. Managed service in IBM Bluemix
OpenWhisk in a nutshell
whisk (v) : to move nimbly and quickly. Source: merriam-webster.com
Design principles & technical approach
1. Open interface for event providers 2. Polyglot support 3. Support higher-level programming constructs as appropriate (e.g. sequencing) 4. Scales on a per-request basis 5. Enable sharing of actions & event providers
• Implementation – Started in node, switched to Scala
• Leverages Docker, Kafka, consul, Akka, …
• Apache 2 license
6
Traditional model
Swift
Application
Container! VM CF!
2
Polling
1b
Request
1a • Continous polling due to missing event programming model
• Charged even when idling • Worry about scaling
Process & idle
OpenWhisk – execution model
• Introduces event programming model • Charges only for what is used • Scales inherently
Pool of actions
Swift! Docker JS!
Trigger
1
Running action
Running action
Running action
3
Deploy action within millisecs, run it, free up resources
OpenWhisk Engine
2
OpenWhisk: How does it work?
} 1
Event Providers
OpenWhisk
Cloudant
Git
Weather
…
…
Data event occurs, e.g. - Commit on a Git Repository - CRUD operation on Cloudant - ….
Trigger execution of associated OpenWhisk action
2
… JS Swift! Docker …
Variety of languages
OpenWhisk: How does it work?
OpenWhisk
JS Swift! Docker …
Incoming HTTP request, e.g. HTTP POST mynewcoolapp.com/customers
1 2 Invoke associated OpenWhisk action Browser
Mobile App
Web App
Usage Scenarios
• Microservices-based apps / APIs
• Mobile Backends
• Data (Stream) Processing
• IoT
• Cognitive
• Bots 11
OpenWhisk as an alternative compute model in Bluemix
12
“Making containers a first class citizen of OpenWhisk is very interesting, and a move which takes the direction of serverless architectures into many potentially new directions and combinations.” – RedMonk*
abstraction Full stack control
Programming model
• Services define the events they emit as triggers, and developers associate the actions to handle the events via rules
• The developer only needs to care about implementing the desired application logic - the system handles the rest
T R A
OpenWhisk – architectural concepts
Trigger
Package
Feed
Package
Feed
Package
Feed
Package
Feed
REST
CLI iOS SDK
CRUD triggers, actions, and rules Invoke actions
UI
Action
NodeJS
Action
Swift
Action
Docker
Rule
Rule
Rule
Action
NodeJS
Action
Docker
Service ecosytem
Bluemix services 3rd party services
Self-enabled services
Chain Chain Invoke
Docker (and potentially other abstractions going forward)
Summary
• Actions are executed, blocking or non-blocking, in response to events or timer-based (cron syntax, 1s granularity)
• Actions can be in Node, Swift, or Docker containers to execute custom logic… and there is more to come
• Actions can be chained to compose powerful solutions • Event Providers can be added via packages • Out of the box support for event sources such as Cloudant (couchDB),
Github, … • Tooling comprised of CLI, REST API, and iOS SDK
How can I get my hands on OpenWhisk?
1. Want to try out our IBM Bluemix OpenWhisk offering? • Sign-up today at: https://new-console.ng.bluemix.net/openwhisk/
2. Want to try out the open-source OpenWhisk project? • Visit: https://github.com/openwhisk/openwhisk/
17