Apache OpenWhiskで⼿に
⼊れるサーバーレスの今
【DC-5】
IBM
Developer Advocate
佐々⽊ シモン Simon Sasaki
サーバーレスとは?
OpenWhisk is an Apache Incubator Project. It is an
open source implementation of a distributed, event-
driven compute service. You can run it on your own
hardware on-prem, or in the cloud. When running in the
cloud you could use a Platform as as Service (PaaS)
version of the OpenWhisk provided by IBM Cloud
Functions, or you can provision it yourself into
Infrastructure as a Service (IaaS) clouds, such as IBM
Cloud, Amazon EC2, Microsoft Azure, Google GCP, etc.
このセッションについて
⽬的
lクラウド上のイベント駆動プログラミングを考える
lApache OpenWhiskの概要を知る
lIBM Cloud Functions(マネージドOpenWhisk)でのプ
ログラミングを学ぶ
ゴール
l今⽇からIBM Cloud Functionsでイベント駆動型の開
発できるようになる
What is event-driven compute
service ?
IBM Code Pattern - Serverless x 17
Results
Trigger
(event)
Data sources define events
they emit as Triggers
Rule (map)
Action
(function)
Developers map Actions
to Triggers via Rules
Package
(feed)
Packages provide integration
with external event sources
What Is Serverless Computing,
and Why Should I Care?
What makes serverless architectures so attractive?
https://developer.ibm.com/opentech/2016/09/06/what-makes-
serverless-attractive/
What is Serverless computing (Functions-as-a-Service)?
Increasingfocusonbusinesslogic
Decreasing concern (and control) over stack implementation
Bare Metal
Virtual machines
Functions
Containers
Why is serverless better than a traditional approach?
Worry about scaling
• When to scale? (mem-, cpu-, response time-, etc. driven?)
• How fast can you scale?
Worry about resiliency & cost
• At least 2 processes for HA
• Keep them running & healthy
• Deployment in multiple regions
Charged even when idling / not 100% utilized
Continuous polling due to missing event programming model
Traditional model
Process
and Idle
Scales inherently
• One process per request
No cost overhead for resiliency
• No long running process to be made HA / multi-region
Introduces event programming model
Charges only for what is used
• Only worry about code
higher dev velocity, lower operational costs
Serverless model
Deploy actions
within millisecs,
run it, free up
resources
Why is serverless better than a traditional approach?
Source Code (Node.js)
/** Apache OpenWhisk **/
function main(params) {
return { message: 'Hello World' };
}
/** AWS Lambda **/
exports.handler = async (event) => {
// TODO implement
return 'Hello from Lambda!'
};
Allows packaging of pieces of a serverless
application into a single project and deploy
it in a vendor-agnostic way.
Serverless
Framework support
What is IBM Cloud Functions (Apache OpenWhisk)?
How does OpenWhisk fit into
our cloud ecosystem?
OpenSouce @ IBM https://developer.ibm.com/code/open/
How does IBM Cloud Functions fit into our cloud ecosystem?
• Control over runtime environment (runtimes,
versions, minimal OS).
• Greater reusability and portability of
container images.
• Great fit for bringing containerized apps and
systems to the cloud.
• OS, runtime, and even container lifecycle is
completely abstracted (serverless).
• Autoscales in response to demand, with an
associated granular cost model.
• Great fit for emerging, non-HTTP, event-
driven workloads involving IoT, data,
messages.
• More responsibility over package
configuration (security patches).
• Need to understand distributed systems.
• An emerging computing model, rapid
innovation with less comprehensive and
stable documentation, samples, tools, and
best practices.
Full control over infrastructure
and maximum portability
Auto-scaled, event-driven applications
that respond to a variety of triggers
Containers-as-a-Service Functions-as-a-Service
IBM Cloud Functions
==Managed Apache OpenWhisk
Demo
Hello World/
Demo https://console.bluemix.net/openwhisk/
Event
Provider Periodic IBM Cloudant IBM Message Hub
Mobile Push Github IBM App Connect
Demo
Create Predic Trigger
Supported
Languages
Multi-
language
Support
Community
Efforts
… and more to come
JS/NodeJS 8
Java, Go
Python 3
Swift 4
Docker
Ruby
…
Scala
PHP 7
What is IBM Cloud Functions (Apache OpenWhisk)?
Kotlin
Supports
higher-level
programming
constructs Sequencing
Conditionals
Loops
Error handling
Parameter
binding
What is IBM Cloud Functions (Apache OpenWhisk)?
IBM Cloud Functions Shell and Composer
Pricing model
Time an action was running *
memory allocated to action
$0.000017 per GBs
Free tier: 400,000 GBs
What is IBM Cloud Functions (Apache OpenWhisk)?
What would I use
IBM Cloud Functions for?
Data
processing
What are the ideal IBM Cloud Functions use cases?
API Gateway
support
AI Bot (Cognitive)Automation
Data
processing
What are the ideal IBM Cloud Functions use cases?
IBM Cloud Functions
API Gateway
support
Allows to map API endpoints
to IBM Cloud Functions actions
Serverless microservice APIs/backend
Available for free, without limits
Define Actions:
getCostumer
createCostumer
deleteCostumer
Define API Endpoints (URLs) and map to Actions
GET: mydomain.com/…/customers
POST: mydomain.com/…/customers
DELETE: mydomain.com/…/customers
12
What are the ideal IBM Cloud Functions use cases?
IBM Cloud Functions
Outsource compute-intensive tasks to a powerful &
scalable serverless platform and implement your actions
even without changing the programming language.
Mobile
backend
What are the ideal IBM Cloud Functions use cases?
IBM Cloud Functions
Watson IoT
Realtime
Insights
Trigger events based on IoT
sensor data
Device
1Weather
Update
Trigger
Watson IOT
Platform
Realtime Insights rules2 3
4 Trigger an Action
IBM Cloud
Functions
What are the ideal IBM Cloud Functions use cases?
Cognitive
What are the ideal IBM Cloud Functions use cases?
IBM Cloud Functions
IBM Code Pattern – Watson and Alexa
まとめ
まとめ
lクラウド・ネイティブなアプリ開発は
イベント駆動プログラミングで
lApache OpenWhiskはオープンソース
lIBM Cloud Functions(マネージドOpenWhisk)なら
イベント駆動プログラミングに今すぐ着⼿
ご静聴ありがとうございました。
IBM Code Patterns
developer.ibm.com/code/technologies/serverless/
Medium medium.com/openwhisk
SlideShare slideshare.net/openwhisk
IBM hosted offering
bluemix.net/openwhisk
Open source project
openwhisk.org
Learn
more
Watson Build
2018
Think.
Build.
Showcase.
世界に⾶び出すソリューションを
IBM	CloudとWatson	APIを使って作ろう!
ビジネス・プランの提出は、7⽉17⽇まで。
プロトタイプの作成は、11⽉6⽇まで。
⽇本チャンピオンおよび選考通過企業は、2019年 IBMイベント@サンフランシスコで
ソリューション展⽰ができます!
詳細はこちら: ibm.biz/jp_bpbuild
© 2018 IBM Corporation
IBM スキル・
スターター・パック
新規IBMビジネス・パートナー様特典
l 1,200⽶ドルのIBM Cloudサービス・
クレジット
l IBM認定試験 無料バウチャー2枚
詳細はこちら: http://ibm.biz/cloud_start

Apache OpenWhisk