SlideShare a Scribd company logo
1 of 30
Download to read offline
© 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

More Related Content

What's hot

What's hot (20)

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...
Cloud Native Architectures with an Open Source, Event Driven, Serverless Plat...
 
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: Keynote
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
 
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...
IBM Bluemix OpenWhisk: Serverless Conference 2017, Austin, USA: The journey c...
 
OpenWhisk - Serverless Architecture
OpenWhisk - Serverless Architecture OpenWhisk - Serverless Architecture
OpenWhisk - Serverless Architecture
 
OpenWhisk - A platform for cloud native, serverless, event driven apps
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
 
Serverless architectures built on an open source platform
Serverless architectures built on an open source platformServerless architectures built on an open source platform
Serverless architectures built on an open source platform
 
Apache OpenWhisk - KRnet 2017
Apache OpenWhisk - KRnet 2017Apache OpenWhisk - KRnet 2017
Apache OpenWhisk - KRnet 2017
 
Building Serverless Applications on the Apache OpenWhisk Platform
Building Serverless Applications on the Apache OpenWhisk PlatformBuilding Serverless Applications on the Apache OpenWhisk Platform
Building Serverless Applications on the Apache OpenWhisk Platform
 
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 ...
IBM Bluemix OpenWhisk: Interconnect 2016, Las Vegas: CCD-1088: The Future of ...
 
IBM Bluemix OpenWhisk: IBM InterConnect 2017, Las Vegas, USA: Technical Strategy
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
 
How to develop your first cloud-native Applications with Java
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
 
How to develop your first cloud-native Applications with Java - 30 Minutes
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
 
Reactive Microservices with Quarkus
Reactive Microservices with QuarkusReactive Microservices with Quarkus
Reactive Microservices with Quarkus
 
Serverless apps with OpenWhisk
Serverless apps with OpenWhiskServerless apps with OpenWhisk
Serverless apps with OpenWhisk
 
OpenWhisk Meetup - Austin, TX 07/2017
OpenWhisk Meetup - Austin, TX 07/2017OpenWhisk Meetup - Austin, TX 07/2017
OpenWhisk Meetup - Austin, TX 07/2017
 
Api more than payload (2021 Update)
Api more than payload (2021 Update)Api more than payload (2021 Update)
Api more than payload (2021 Update)
 
Jakarta Tech Talk: How to develop your first cloud-native Application with Java
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
 
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...
Open Container Technologies and OpenStack - Sorting Through Kubernetes, the O...
 
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 ...
IBM Bluemix OpenWhisk: Serverless Conference 2016, London, UK: The Future of ...
 
OpenWhisk Deep Dive: the action container model
OpenWhisk Deep Dive: the action container modelOpenWhisk Deep Dive: the action container model
OpenWhisk Deep Dive: the action container model
 

Similar to Serverless APIs with Apache OpenWhisk

Similar to Serverless APIs with Apache OpenWhisk (20)

Being serverless and Swift... Is that allowed?
Being serverless and Swift... Is that allowed? Being serverless and Swift... Is that allowed?
Being serverless and Swift... Is that allowed?
 
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...
How to build a Distributed Serverless Polyglot Microservices IoT Platform us...
 
Serverless Apps with Open Whisk
Serverless Apps with Open Whisk Serverless Apps with Open Whisk
Serverless Apps with Open Whisk
 
Apache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless ComputingApache OpenWhisk Serverless Computing
Apache OpenWhisk Serverless Computing
 
Microservices and Serverless Computing - OpenWhisk
Microservices and Serverless Computing - OpenWhiskMicroservices and Serverless Computing - OpenWhisk
Microservices and Serverless Computing - OpenWhisk
 
The Future of Web Application Architectures
The Future of Web Application ArchitecturesThe Future of Web Application Architectures
The Future of Web Application Architectures
 
Mobile, Open Source, and the Drive to the Cloud
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
 
Mobile, Open Source, & the Drive to the Cloud
Mobile, Open Source, & the Drive to the CloudMobile, Open Source, & the Drive to the Cloud
Mobile, Open Source, & the Drive to the Cloud
 
Apache OpenWhisk
Apache OpenWhiskApache OpenWhisk
Apache OpenWhisk
 
Creating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and KubernetesCreating microservices architectures using node.js and Kubernetes
Creating microservices architectures using node.js and Kubernetes
 
Docker serverless v1.0
Docker serverless v1.0Docker serverless v1.0
Docker serverless v1.0
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016
 
0507 057 01 98 * Adana Klima Tamir Servisi
0507 057 01 98 * Adana Klima Tamir Servisi0507 057 01 98 * Adana Klima Tamir Servisi
0507 057 01 98 * Adana Klima Tamir Servisi
 
Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016
 
Serverless forwardjs
Serverless forwardjsServerless forwardjs
Serverless forwardjs
 
Containers as a Service with Docker
Containers as a Service with DockerContainers as a Service with Docker
Containers as a Service with Docker
 
Docker Container As A Service - March 2016
Docker Container As A Service - March 2016Docker Container As A Service - March 2016
Docker Container As A Service - March 2016
 
When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?When to use Serverless? When to use Kubernetes?
When to use Serverless? When to use Kubernetes?
 
OpenFaaS - zero serverless in 60 seconds anywhere with case-studies
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
 
Front-end. Global domination
Front-end. Global dominationFront-end. Global domination
Front-end. Global domination
 

More from 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...
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...
Daniel Krook
 

More from Daniel Krook (17)

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...
Commit to the Cause, Push for Change: Contributing to Call for Code Open Sour...
 
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...
Engaging Open Source Developers to Develop Tech for Good through Code and Res...
 
COVID-19 and Climate Change Action Through Open Source Technology
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
 
Containers, OCI, CNCF, Magnum, Kuryr, and You!
Containers, OCI, CNCF, Magnum, Kuryr, and You!Containers, OCI, CNCF, Magnum, Kuryr, and You!
Containers, OCI, CNCF, Magnum, Kuryr, and You!
 
Taking the Next Hot Mobile Game Live with Docker and IBM SoftLayer
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
 
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. ...
CAPS: What's best for deploying and managing OpenStack? Chef vs. Ansible vs. ...
 
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...
The Containers Ecosystem, the OpenStack Magnum Project, the Open Container In...
 
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...
Quickly build and deploy a scalable OpenStack Swift application using IBM Blu...
 
Finding and Organizing a Great Cloud Foundry User Group
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
 
IBM and OpenStack: Collaboration Beyond the Code
IBM and OpenStack: Collaboration Beyond the CodeIBM and OpenStack: Collaboration Beyond the Code
IBM and OpenStack: Collaboration Beyond the Code
 
Dockerizing OpenStack for High Availability
Dockerizing OpenStack for High AvailabilityDockerizing OpenStack for High Availability
Dockerizing OpenStack for High Availability
 
Power Systems Projects in Research
Power Systems Projects in ResearchPower Systems Projects in Research
Power Systems Projects in Research
 
Neutron Networking: Service Groups, Policies and Chains
Neutron Networking: Service Groups, Policies and ChainsNeutron Networking: Service Groups, Policies and Chains
Neutron Networking: Service Groups, Policies and Chains
 
Advanced Data Retrieval and Analytics with Apache Spark and Openstack Swift
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
 
Docker Container Cloud
Docker Container CloudDocker Container Cloud
Docker Container Cloud
 
Building a hybrid, dynamic cloud on an open architecture
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
 
Cloud Foundry for PHP developers
Cloud Foundry for PHP developersCloud Foundry for PHP developers
Cloud Foundry for PHP developers
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Recently uploaded (20)

The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 

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