Serverless APIs with Apache OpenWhisk

Daniel Krook
Daniel KrookChief Technology Officer - The Call for Code Global Initiative & IBM Code and Response
© 2017 IBM Corporation l Interconnect 2017
Build serverless web and mobile APIs
that scale automatically in response to demand
@DanielKrook
Daniel Krook

Software Engineer & Developer Advocate
github.com/krook/oscon
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Increasingfocusonbusinesslogic
Decreasing concern (and control) over stack implementation
Bare Metal
VM VM
VM
Virtual machines
Functions
Containers
Serverless developers focus more on code, less on infrastructure
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Monolithic
Application
Break-down into
microservices
Make each
microservice HA
Protect against
regional outage
Region A
Region B
Microservices can be hard to manage at scale
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Emerging workloads are a good fit for event-driven programming
Execute logic in response to database change
Perform analytics on sensor input messages
Provide cognitive computing via chatbots
Schedule tasks performed for a short time
Invoke autoscaled APIs and mobile backends
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Memory
allocated
(MB)
Time executing
(milliseconds)
Instances
executing
simultaneously
(count)
Cloud resource cost
better matches
business value gained
Not a silver bullet, but this can result in
substantial savings for many workloads
New cost models more accurately charge for usage
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Why serverless? Mobile video game popularity is hard to predictNumberofactiveusers
(unpredictable)
Days since latest release (predictable)
Active users curve for a
new mobile game has a
predictable shape, but an
unpredictable volume
1 5 10
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Why serverless? Conference mobile apps have huge variations in demandNumberofactiveusers
(massivelyvariable)
Days of the week (predictable)
Active users curve for a mobile
conference app has no demand before
and after the conference, and huge
intraweek swings in demand
Monday Tuesday Wednesday Thursday
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Why serverless? Mobile banking often peaks massively on paydayNumberofactiveusers
(stablewithamassivepeak)
Days of the pay period (predictable)
Mobile banking apps often have
peaks in demand on payday,
once every two weeks
Friday
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Apache OpenWhisk
is a cloud platform
that executes code in
response to events
Apache OpenWhisk enables these serverless, event-driven workloads
Provides serverless deployment and operations model
Runs code only on-demand on a per-request basis
Optimized utilization, fine-grained metering at any scale
Flexible, extensible, polyglot programming model
Open source and open ecosystem (Apache Incubator)
Ability to run in public, private, and hybrid models
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Apache
Incubator
OpenWhisk is built on solid open source foundations
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Apache
Incubator
The OpenWhisk ecosystem is growing
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
But what about PaaS and container orchestration?Increasingfocusonbusinesslogic
Decreasing concern (and control) over stack implementation
Full control over infrastructure
and maximum portability
Focus on the application and let
the platform handle the rest
Auto-scaled, event-driven applications
that respond to a variety of triggers
Containers
Applications
Functions
© 2017 IBM Corporation l Interconnect 2017
Apache OpenWhisk
programming model
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Results
Developers work with packages, triggers, actions, and rules
Package
(feed)
Packages provide integration
with external event sources
P
Trigger
(event)
T
Data sources define events
they emit as Triggers
Rule (map)R
Action
(function)
A
Developers map Actions
to Triggers via Rules
Data sources define events
they emit as Triggers.
Developers map Actions to
Triggers via Rules.
T
A
R
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Triggers
A class of events that can occurT
Social events
Data changes
Device readings Location updates
User input
Invocations can be blocking, non-blocking, or periodic
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Actions
Code that runs in response to an event
(that is, an event handler)
A
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Actions
Can be written in a variety of languages, such as
JavaScript, Python, Java, PHP, and Swift
A
function main(params) {
return { message: 'Hello, ' + params.name + ' from ' + params.place };
};
Multi-
language
Support
JS/NodeJS 8
Java
Python 3
Swift 4
Docker
PHP 7
Community
Efforts
Go
Rust
Ruby
…
bash
C
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Actions
Can be written in a variety of languages, such as
JavaScript, Python, Java, PHP, and Swift
A
function main(params) {
return { message: 'Hello, ' + params.name + ' from ' + params.place };
};
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Actions
Or any other language by packaging with DockerA
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Actions
Can be composed to create sequences
that increase flexibility and foster reuse
A
AA := A1 + A2 + A3
AB := A2 + A1 + A3
AC := A3 + A1 + A2
Plus:
• Sequencing
• Conditionals
• Loops
• Error handling
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Rules
An association of a trigger to an action
in a many to many mapping.
R
R := T A
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Packages
A shared collection of triggers and actionsP
A
A read
write
T changes A translate A forecast
A post
T topic
Open
Source A myAction
T myFeed
Yours
T commit
Third
Party
© 2017 IBM Corporation l Interconnect 2017
Apache OpenWhisk
in action
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
OpenWhisk awaits events, fetches mapped code, runs it in a container
Pool of actions
Swift DockerJS
Trigger
1
Running
action
Running
action
Running
action
3
OpenWhisk
Engine
2 A
T
AAA
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Open source software as a service on the IBM Cloud
Open source Hosted service
Serverless engine Apache OpenWhisk IBM Cloud Functions
API Gateway LoopBack IBM API Gateway
Databases
Apache CouchDB
MySQL
IBM Cloudant
IBM Compose
Message streams Apache Kafka IBM Message Hub
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Demo 1: Your first OpenWhisk trigger, action, and rule
$ bx wsk action create handler handler.js
$ bx wsk action invoke --blocking handler
$ bx wsk trigger create every-20-seconds 
--feed /whisk.system/alarms/alarm 
--param cron "*/20 * * * * *" 
--param maxTriggers 15
$ bx wsk rule create 
invoke-periodically 
every-20-seconds 
handler
Trigger
1
Running
action
2
T
A
1. Cron syntax alarm
2. Log the current time
$ bx wsk activation poll
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Demo 2: Mapping an HTTP request to an action
These demo actions are written in JavaScript.
But you could write the equivalent in Swift to reuse the same skills on mobile device and backend services.
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Demo 3: HTTP REST APIs with full create, read, update, delete methods
Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon
Delivered as

Open source via Apache
openwhisk.org
Managed OpenWhisk with
IBM Cloud Functions
bluemix.net/openwhisk
Get started with Apache OpenWhisk
github.com/openwhisk
slack.openwhisk.org
twitter.com/openwhisk
medium.com/openwhisk
© 2017 IBM Corporation l Interconnect 2017
Build serverless web and mobile APIs
that scale automatically in response to demand
@DanielKrook
Daniel Krook

Software Engineer & Developer Advocate
github.com/krook/oscon
1 of 30

Recommended

Building serverless applications with Apache OpenWhisk and IBM Cloud Functions by
Building serverless applications with Apache OpenWhisk and IBM Cloud FunctionsBuilding serverless applications with Apache OpenWhisk and IBM Cloud Functions
Building serverless applications with Apache OpenWhisk and IBM Cloud FunctionsDaniel Krook
1.1K views30 slides
Serverless Architectures in Banking: OpenWhisk on IBM Bluemix at Santander by
Serverless Architectures in Banking: OpenWhisk on IBM Bluemix at SantanderServerless Architectures in Banking: OpenWhisk on IBM Bluemix at Santander
Serverless Architectures in Banking: OpenWhisk on IBM Bluemix at SantanderDaniel Krook
1.2K views34 slides
Building serverless applications with Apache OpenWhisk by
Building serverless applications with Apache OpenWhiskBuilding serverless applications with Apache OpenWhisk
Building serverless applications with Apache OpenWhiskDaniel Krook
1.8K views29 slides
Workshop: Develop Serverless Applications with IBM Cloud Functions by
Workshop: Develop Serverless Applications with IBM Cloud FunctionsWorkshop: Develop Serverless Applications with IBM Cloud Functions
Workshop: Develop Serverless Applications with IBM Cloud FunctionsDaniel Krook
1.3K views48 slides
The CNCF on Serverless by
The CNCF on ServerlessThe CNCF on Serverless
The CNCF on ServerlessDaniel Krook
1.4K views12 slides
Containers vs serverless - Navigating application deployment options by
Containers vs serverless - Navigating application deployment optionsContainers vs serverless - Navigating application deployment options
Containers vs serverless - Navigating application deployment optionsDaniel Krook
8.7K views30 slides

More Related Content

What's hot

Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat... by
Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...
Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...Daniel Krook
1.9K views12 slides
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: Keynote by
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: KeynoteIBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: Keynote
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: KeynoteOpenWhisk
6.4K views50 slides
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c... by
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...OpenWhisk
2.4K views39 slides
OpenWhisk - Serverless Architecture by
OpenWhisk - Serverless Architecture OpenWhisk - Serverless Architecture
OpenWhisk - Serverless Architecture Dev_Events
1.2K views41 slides
OpenWhisk - A platform for cloud native, serverless, event driven apps by
OpenWhisk - A platform for cloud native, serverless, event driven appsOpenWhisk - A platform for cloud native, serverless, event driven apps
OpenWhisk - A platform for cloud native, serverless, event driven appsDaniel Krook
7.7K views39 slides
Serverless architectures built on an open source platform by
Serverless architectures built on an open source platformServerless architectures built on an open source platform
Serverless architectures built on an open source platformDaniel Krook
7.2K views12 slides

What's hot(20)

Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat... by Daniel Krook
Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...
Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...
Daniel Krook1.9K views
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: Keynote by OpenWhisk
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: KeynoteIBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: Keynote
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: Keynote
OpenWhisk6.4K views
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c... by OpenWhisk
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...
OpenWhisk2.4K views
OpenWhisk - Serverless Architecture by Dev_Events
OpenWhisk - Serverless Architecture OpenWhisk - Serverless Architecture
OpenWhisk - Serverless Architecture
Dev_Events1.2K views
OpenWhisk - A platform for cloud native, serverless, event driven apps by Daniel Krook
OpenWhisk - A platform for cloud native, serverless, event driven appsOpenWhisk - A platform for cloud native, serverless, event driven apps
OpenWhisk - A platform for cloud native, serverless, event driven apps
Daniel Krook7.7K views
Serverless architectures built on an open source platform by Daniel Krook
Serverless architectures built on an open source platformServerless architectures built on an open source platform
Serverless architectures built on an open source platform
Daniel Krook7.2K views
Apache OpenWhisk - KRnet 2017 by Jin Gi Kong
Apache OpenWhisk - KRnet 2017Apache OpenWhisk - KRnet 2017
Apache OpenWhisk - KRnet 2017
Jin Gi Kong179 views
Building Serverless Applications on the Apache OpenWhisk Platform by Joe Sepi
Building Serverless Applications on the Apache OpenWhisk PlatformBuilding Serverless Applications on the Apache OpenWhisk Platform
Building Serverless Applications on the Apache OpenWhisk Platform
Joe Sepi358 views
IBM Bluemix OpenWhisk: Interconnect 2016, Las Vegas: CCD-1088: The Future of ... by OpenWhisk
IBM Bluemix OpenWhisk: Interconnect 2016, Las Vegas: CCD-1088: The Future of ...IBM Bluemix OpenWhisk: Interconnect 2016, Las Vegas: CCD-1088: The Future of ...
IBM Bluemix OpenWhisk: Interconnect 2016, Las Vegas: CCD-1088: The Future of ...
OpenWhisk2.5K views
IBM Bluemix OpenWhisk: IBM InterConnect 2017, Las Vegas, USA: Technical Strategy by OpenWhisk
IBM Bluemix OpenWhisk: IBM InterConnect 2017, Las Vegas, USA: Technical StrategyIBM Bluemix OpenWhisk: IBM InterConnect 2017, Las Vegas, USA: Technical Strategy
IBM Bluemix OpenWhisk: IBM InterConnect 2017, Las Vegas, USA: Technical Strategy
OpenWhisk2.3K views
How to develop your first cloud-native Applications with Java by Niklas Heidloff
How to develop your first cloud-native Applications with JavaHow to develop your first cloud-native Applications with Java
How to develop your first cloud-native Applications with Java
Niklas Heidloff14.4K views
How to develop your first cloud-native Applications with Java - 30 Minutes by Niklas Heidloff
How to develop your first cloud-native Applications with Java - 30 MinutesHow to develop your first cloud-native Applications with Java - 30 Minutes
How to develop your first cloud-native Applications with Java - 30 Minutes
Niklas Heidloff598 views
Reactive Microservices with Quarkus by Niklas Heidloff
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with Quarkus
Niklas Heidloff577 views
Serverless apps with OpenWhisk by Daniel Krook
Serverless apps with OpenWhiskServerless apps with OpenWhisk
Serverless apps with OpenWhisk
Daniel Krook875 views
OpenWhisk Meetup - Austin, TX 07/2017 by Carlos Santana
OpenWhisk Meetup - Austin, TX 07/2017OpenWhisk Meetup - Austin, TX 07/2017
OpenWhisk Meetup - Austin, TX 07/2017
Carlos Santana302 views
Api more than payload (2021 Update) by Phil Wilkins
Api more than payload (2021 Update)Api more than payload (2021 Update)
Api more than payload (2021 Update)
Phil Wilkins67 views
Jakarta Tech Talk: How to develop your first cloud-native Application with Java by Niklas Heidloff
Jakarta Tech Talk: How to develop your first cloud-native Application with JavaJakarta Tech Talk: How to develop your first cloud-native Application with Java
Jakarta Tech Talk: How to develop your first cloud-native Application with Java
Niklas Heidloff793 views
Open Container Technologies and OpenStack - Sorting Through Kubernetes, the O... by Daniel Krook
Open Container Technologies and OpenStack - Sorting Through Kubernetes, the O...Open Container Technologies and OpenStack - Sorting Through Kubernetes, the O...
Open Container Technologies and OpenStack - Sorting Through Kubernetes, the O...
Daniel Krook1.4K views
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ... by OpenWhisk
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
OpenWhisk3.9K views
OpenWhisk Deep Dive: the action container model by Philippe Suter
OpenWhisk Deep Dive: the action container modelOpenWhisk Deep Dive: the action container model
OpenWhisk Deep Dive: the action container model
Philippe Suter2.4K views

Similar to Serverless APIs with Apache OpenWhisk

Being serverless and Swift... Is that allowed? by
Being serverless and Swift... Is that allowed? Being serverless and Swift... Is that allowed?
Being serverless and Swift... Is that allowed? Dev_Events
235 views43 slides
How to build a Distributed Serverless Polyglot Microservices IoT Platform us... by
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...Animesh Singh
5.6K views67 slides
Serverless Apps with Open Whisk by
Serverless Apps with Open Whisk Serverless Apps with Open Whisk
Serverless Apps with Open Whisk Dev_Events
404 views41 slides
Apache OpenWhisk Serverless Computing by
Apache OpenWhisk Serverless ComputingApache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless ComputingUpkar Lidder
114 views28 slides
Microservices and Serverless Computing - OpenWhisk by
Microservices and Serverless Computing - OpenWhiskMicroservices and Serverless Computing - OpenWhisk
Microservices and Serverless Computing - OpenWhiskVidyasagar Machupalli
156 views34 slides
The Future of Web Application Architectures by
The Future of Web Application ArchitecturesThe Future of Web Application Architectures
The Future of Web Application ArchitecturesLucas Carlson
622 views44 slides

Similar to Serverless APIs with Apache OpenWhisk(20)

Being serverless and Swift... Is that allowed? by Dev_Events
Being serverless and Swift... Is that allowed? Being serverless and Swift... Is that allowed?
Being serverless and Swift... Is that allowed?
Dev_Events235 views
How to build a Distributed Serverless Polyglot Microservices IoT Platform us... by Animesh Singh
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
Animesh Singh5.6K views
Serverless Apps with Open Whisk by Dev_Events
Serverless Apps with Open Whisk Serverless Apps with Open Whisk
Serverless Apps with Open Whisk
Dev_Events404 views
Apache OpenWhisk Serverless Computing by Upkar Lidder
Apache OpenWhisk Serverless ComputingApache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless Computing
Upkar Lidder114 views
The Future of Web Application Architectures by Lucas Carlson
The Future of Web Application ArchitecturesThe Future of Web Application Architectures
The Future of Web Application Architectures
Lucas Carlson622 views
Mobile, Open Source, & the Drive to the Cloud by Dev_Events
Mobile, Open Source, & the Drive to the CloudMobile, Open Source, & the Drive to the Cloud
Mobile, Open Source, & the Drive to the Cloud
Dev_Events367 views
Mobile, Open Source, and the Drive to the Cloud by Dev_Events
Mobile, Open Source, and the Drive to the CloudMobile, Open Source, and the Drive to the Cloud
Mobile, Open Source, and the Drive to the Cloud
Dev_Events223 views
Creating microservices architectures using node.js and Kubernetes by Paul Goldbaum
Creating microservices architectures using node.js and KubernetesCreating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and Kubernetes
Paul Goldbaum741 views
Docker serverless v1.0 by Thomas Chacko
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
Thomas Chacko7.5K views
Docker Container As A Service - JAX 2016 by Patrick Chanezon
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016
Patrick Chanezon11.2K views
Docker Container As A Service - Mix-IT 2016 by Patrick Chanezon
Docker Container As A Service - Mix-IT 2016Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016
Patrick Chanezon1.3K views
Containers as a Service with Docker by Docker, Inc.
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
Docker, Inc.3.1K views
Docker Container As A Service - March 2016 by Patrick Chanezon
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
Patrick Chanezon3.5K views
When to use Serverless? When to use Kubernetes? by Niklas Heidloff
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
Niklas Heidloff1.6K views
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies by Alex Ellis
OpenFaaS - zero serverless in 60 seconds anywhere with case-studiesOpenFaaS - zero serverless in 60 seconds anywhere with case-studies
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies
Alex Ellis907 views

More from Daniel Krook

Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour... by
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...Daniel Krook
236 views76 slides
Engaging Open Source Developers to Develop Tech for Good through Code and Res... by
Engaging Open Source Developers to Develop Tech for Good through Code and Res...Engaging Open Source Developers to Develop Tech for Good through Code and Res...
Engaging Open Source Developers to Develop Tech for Good through Code and Res...Daniel Krook
370 views41 slides
COVID-19 and Climate Change Action Through Open Source Technology by
COVID-19 and Climate Change Action Through Open Source TechnologyCOVID-19 and Climate Change Action Through Open Source Technology
COVID-19 and Climate Change Action Through Open Source TechnologyDaniel Krook
545 views40 slides
Containers, OCI, CNCF, Magnum, Kuryr, and You! by
Containers, OCI, CNCF, Magnum, Kuryr, and You!Containers, OCI, CNCF, Magnum, Kuryr, and You!
Containers, OCI, CNCF, Magnum, Kuryr, and You!Daniel Krook
1.9K views17 slides
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayer by
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayerTaking the Next Hot Mobile Game Live with Docker and IBM SoftLayer
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayerDaniel Krook
1.7K views33 slides
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ... by
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...Daniel Krook
13.5K views49 slides

More from Daniel Krook(17)

Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour... by Daniel Krook
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
Daniel Krook236 views
Engaging Open Source Developers to Develop Tech for Good through Code and Res... by Daniel Krook
Engaging Open Source Developers to Develop Tech for Good through Code and Res...Engaging Open Source Developers to Develop Tech for Good through Code and Res...
Engaging Open Source Developers to Develop Tech for Good through Code and Res...
Daniel Krook370 views
COVID-19 and Climate Change Action Through Open Source Technology by Daniel Krook
COVID-19 and Climate Change Action Through Open Source TechnologyCOVID-19 and Climate Change Action Through Open Source Technology
COVID-19 and Climate Change Action Through Open Source Technology
Daniel Krook545 views
Containers, OCI, CNCF, Magnum, Kuryr, and You! by Daniel Krook
Containers, OCI, CNCF, Magnum, Kuryr, and You!Containers, OCI, CNCF, Magnum, Kuryr, and You!
Containers, OCI, CNCF, Magnum, Kuryr, and You!
Daniel Krook1.9K views
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayer by Daniel Krook
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayerTaking the Next Hot Mobile Game Live with Docker and IBM SoftLayer
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayer
Daniel Krook1.7K views
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ... by Daniel Krook
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
Daniel Krook13.5K views
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In... by Daniel Krook
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...
Daniel Krook4.3K views
Quickly build and deploy a scalable OpenStack Swift application using IBM Blu... by Daniel Krook
Quickly build and deploy a scalable OpenStack Swift application using IBM Blu...Quickly build and deploy a scalable OpenStack Swift application using IBM Blu...
Quickly build and deploy a scalable OpenStack Swift application using IBM Blu...
Daniel Krook3.2K views
Finding and Organizing a Great Cloud Foundry User Group by Daniel Krook
Finding and Organizing a Great Cloud Foundry User GroupFinding and Organizing a Great Cloud Foundry User Group
Finding and Organizing a Great Cloud Foundry User Group
Daniel Krook2.7K views
IBM and OpenStack: Collaboration Beyond the Code by Daniel Krook
IBM and OpenStack: Collaboration Beyond the CodeIBM and OpenStack: Collaboration Beyond the Code
IBM and OpenStack: Collaboration Beyond the Code
Daniel Krook2K views
Dockerizing OpenStack for High Availability by Daniel Krook
Dockerizing OpenStack for High AvailabilityDockerizing OpenStack for High Availability
Dockerizing OpenStack for High Availability
Daniel Krook8.5K views
Power Systems Projects in Research by Daniel Krook
Power Systems Projects in ResearchPower Systems Projects in Research
Power Systems Projects in Research
Daniel Krook1.1K views
Neutron Networking: Service Groups, Policies and Chains by Daniel Krook
Neutron Networking: Service Groups, Policies and ChainsNeutron Networking: Service Groups, Policies and Chains
Neutron Networking: Service Groups, Policies and Chains
Daniel Krook1.6K views
Advanced Data Retrieval and Analytics with Apache Spark and Openstack Swift by Daniel Krook
Advanced Data Retrieval and Analytics with Apache Spark and Openstack SwiftAdvanced Data Retrieval and Analytics with Apache Spark and Openstack Swift
Advanced Data Retrieval and Analytics with Apache Spark and Openstack Swift
Daniel Krook3.1K views
Docker Container Cloud by Daniel Krook
Docker Container CloudDocker Container Cloud
Docker Container Cloud
Daniel Krook1.5K views
Building a hybrid, dynamic cloud on an open architecture by Daniel Krook
Building a hybrid, dynamic cloud on an open architectureBuilding a hybrid, dynamic cloud on an open architecture
Building a hybrid, dynamic cloud on an open architecture
Daniel Krook1.9K views
Cloud Foundry for PHP developers by Daniel Krook
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developers
Daniel Krook6.2K views

Recently uploaded

SAP FOR TYRE INDUSTRY.pdf by
SAP FOR TYRE INDUSTRY.pdfSAP FOR TYRE INDUSTRY.pdf
SAP FOR TYRE INDUSTRY.pdfVirendra Rai, PMP
24 views3 slides
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...TomHalpin9
5 views29 slides
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...Deltares
6 views15 slides
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsRa'Fat Al-Msie'deen
5 views49 slides
Fleet Management Software in India by
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India Fleetable
11 views1 slide
Tridens DevOps by
Tridens DevOpsTridens DevOps
Tridens DevOpsTridens
9 views28 slides

Recently uploaded(20)

Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated... by TomHalpin9
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
Dev-HRE-Ops - Addressing the _Last Mile DevOps Challenge_ in Highly Regulated...
TomHalpin95 views
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... by Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 views
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports by Ra'Fat Al-Msie'deen
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug ReportsBushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
BushraDBR: An Automatic Approach to Retrieving Duplicate Bug Reports
Fleet Management Software in India by Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 views
Tridens DevOps by Tridens
Tridens DevOpsTridens DevOps
Tridens DevOps
Tridens9 views
AI and Ml presentation .pptx by FayazAli87
AI and Ml presentation .pptxAI and Ml presentation .pptx
AI and Ml presentation .pptx
FayazAli8711 views
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... by Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares14 views
Advanced API Mocking Techniques by Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 views
A first look at MariaDB 11.x features and ideas on how to use them by Federico Razzoli
A first look at MariaDB 11.x features and ideas on how to use themA first look at MariaDB 11.x features and ideas on how to use them
A first look at MariaDB 11.x features and ideas on how to use them
Federico Razzoli45 views
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - GeertsemaDSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
DSD-INT 2023 Delft3D FM Suite 2024.01 1D2D - Beta testing programme - Geertsema
Deltares17 views
Generic or specific? Making sensible software design decisions by Bert Jan Schrijver
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge... by Deltares
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
DSD-INT 2023 Delft3D FM Suite 2024.01 2D3D - New features + Improvements - Ge...
Deltares17 views
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut... by Deltares
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...
DSD-INT 2023 Machine learning in hydraulic engineering - Exploring unseen fut...
Deltares7 views
DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h... by Deltares
DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h...DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h...
DSD-INT 2023 Exploring flash flood hazard reduction in arid regions using a h...
Deltares5 views
Copilot Prompting Toolkit_All Resources.pdf by Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana8 views
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with... by sparkfabrik
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
20231129 - Platform @ localhost 2023 - Application-driven infrastructure with...
sparkfabrik5 views
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action by Márton Kodok
Gen Apps on Google Cloud PaLM2 and Codey APIs in ActionGen Apps on Google Cloud PaLM2 and Codey APIs in Action
Gen Apps on Google Cloud PaLM2 and Codey APIs in Action
Márton Kodok5 views
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... by Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri795 views

Serverless APIs with Apache OpenWhisk

  • 1. © 2017 IBM Corporation l Interconnect 2017 Build serverless web and mobile APIs that scale automatically in response to demand @DanielKrook Daniel Krook Software Engineer & Developer Advocate github.com/krook/oscon
  • 2. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Increasingfocusonbusinesslogic Decreasing concern (and control) over stack implementation Bare Metal VM VM VM Virtual machines Functions Containers Serverless developers focus more on code, less on infrastructure
  • 3. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Monolithic Application Break-down into microservices Make each microservice HA Protect against regional outage Region A Region B Microservices can be hard to manage at scale
  • 4. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Emerging workloads are a good fit for event-driven programming Execute logic in response to database change Perform analytics on sensor input messages Provide cognitive computing via chatbots Schedule tasks performed for a short time Invoke autoscaled APIs and mobile backends
  • 5. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Memory allocated (MB) Time executing (milliseconds) Instances executing simultaneously (count) Cloud resource cost better matches business value gained Not a silver bullet, but this can result in substantial savings for many workloads New cost models more accurately charge for usage
  • 6. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Why serverless? Mobile video game popularity is hard to predictNumberofactiveusers (unpredictable) Days since latest release (predictable) Active users curve for a new mobile game has a predictable shape, but an unpredictable volume 1 5 10
  • 7. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Why serverless? Conference mobile apps have huge variations in demandNumberofactiveusers (massivelyvariable) Days of the week (predictable) Active users curve for a mobile conference app has no demand before and after the conference, and huge intraweek swings in demand Monday Tuesday Wednesday Thursday
  • 8. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Why serverless? Mobile banking often peaks massively on paydayNumberofactiveusers (stablewithamassivepeak) Days of the pay period (predictable) Mobile banking apps often have peaks in demand on payday, once every two weeks Friday
  • 9. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Apache OpenWhisk is a cloud platform that executes code in response to events Apache OpenWhisk enables these serverless, event-driven workloads Provides serverless deployment and operations model Runs code only on-demand on a per-request basis Optimized utilization, fine-grained metering at any scale Flexible, extensible, polyglot programming model Open source and open ecosystem (Apache Incubator) Ability to run in public, private, and hybrid models
  • 10. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Apache Incubator OpenWhisk is built on solid open source foundations
  • 11. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Apache Incubator The OpenWhisk ecosystem is growing
  • 12. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon But what about PaaS and container orchestration?Increasingfocusonbusinesslogic Decreasing concern (and control) over stack implementation Full control over infrastructure and maximum portability Focus on the application and let the platform handle the rest Auto-scaled, event-driven applications that respond to a variety of triggers Containers Applications Functions
  • 13. © 2017 IBM Corporation l Interconnect 2017 Apache OpenWhisk programming model
  • 14. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Results Developers work with packages, triggers, actions, and rules Package (feed) Packages provide integration with external event sources P Trigger (event) T Data sources define events they emit as Triggers Rule (map)R Action (function) A Developers map Actions to Triggers via Rules Data sources define events they emit as Triggers. Developers map Actions to Triggers via Rules. T A R
  • 15. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Triggers A class of events that can occurT Social events Data changes Device readings Location updates User input Invocations can be blocking, non-blocking, or periodic
  • 16. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Actions Code that runs in response to an event (that is, an event handler) A
  • 17. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Actions Can be written in a variety of languages, such as JavaScript, Python, Java, PHP, and Swift A function main(params) { return { message: 'Hello, ' + params.name + ' from ' + params.place }; }; Multi- language Support JS/NodeJS 8 Java Python 3 Swift 4 Docker PHP 7 Community Efforts Go Rust Ruby … bash C
  • 18. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Actions Can be written in a variety of languages, such as JavaScript, Python, Java, PHP, and Swift A function main(params) { return { message: 'Hello, ' + params.name + ' from ' + params.place }; };
  • 19. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Actions Or any other language by packaging with DockerA
  • 20. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Actions Can be composed to create sequences that increase flexibility and foster reuse A AA := A1 + A2 + A3 AB := A2 + A1 + A3 AC := A3 + A1 + A2 Plus: • Sequencing • Conditionals • Loops • Error handling
  • 21. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Rules An association of a trigger to an action in a many to many mapping. R R := T A
  • 22. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Packages A shared collection of triggers and actionsP A A read write T changes A translate A forecast A post T topic Open Source A myAction T myFeed Yours T commit Third Party
  • 23. © 2017 IBM Corporation l Interconnect 2017 Apache OpenWhisk in action
  • 24. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon OpenWhisk awaits events, fetches mapped code, runs it in a container Pool of actions Swift DockerJS Trigger 1 Running action Running action Running action 3 OpenWhisk Engine 2 A T AAA
  • 25. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Open source software as a service on the IBM Cloud Open source Hosted service Serverless engine Apache OpenWhisk IBM Cloud Functions API Gateway LoopBack IBM API Gateway Databases Apache CouchDB MySQL IBM Cloudant IBM Compose Message streams Apache Kafka IBM Message Hub
  • 26. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Demo 1: Your first OpenWhisk trigger, action, and rule $ bx wsk action create handler handler.js $ bx wsk action invoke --blocking handler $ bx wsk trigger create every-20-seconds --feed /whisk.system/alarms/alarm --param cron "*/20 * * * * *" --param maxTriggers 15 $ bx wsk rule create invoke-periodically every-20-seconds handler Trigger 1 Running action 2 T A 1. Cron syntax alarm 2. Log the current time $ bx wsk activation poll
  • 27. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Demo 2: Mapping an HTTP request to an action These demo actions are written in JavaScript. But you could write the equivalent in Swift to reuse the same skills on mobile device and backend services.
  • 28. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Demo 3: HTTP REST APIs with full create, read, update, delete methods
  • 29. Serverless Web and Mobile APIs@DanielKrook github.com/krook/oscon Delivered as
 Open source via Apache openwhisk.org Managed OpenWhisk with IBM Cloud Functions bluemix.net/openwhisk Get started with Apache OpenWhisk github.com/openwhisk slack.openwhisk.org twitter.com/openwhisk medium.com/openwhisk
  • 30. © 2017 IBM Corporation l Interconnect 2017 Build serverless web and mobile APIs that scale automatically in response to demand @DanielKrook Daniel Krook Software Engineer & Developer Advocate github.com/krook/oscon