openwhisk: where did my servers go?

37
@csantanapr Where Did My Servers Go? Carlos Santana, IBM [email protected]

Upload: carlos-santana

Post on 19-Mar-2017

98 views

Category:

Software


3 download

TRANSCRIPT

Page 1: OpenWhisk: Where Did My Servers Go?

@csantanapr

Where Did My Servers Go?Carlos Santana, IBM

[email protected]

Page 2: OpenWhisk: Where Did My Servers Go?

@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.

Page 3: OpenWhisk: Where Did My Servers Go?

@csantanapr

Sometimes Servers let us down

• HARD DRIVE FAILS• LINUX OS VULNERABILTY• MIDDLEWARE VERSION UPDATE• MORE MEMORY AND BIGGER CPU• ….

Page 4: OpenWhisk: Where Did My Servers Go?

@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

Page 5: OpenWhisk: Where Did My Servers Go?

@csantanapr

Utilization

Average Utilization20% - 40%of capacity

Page 6: OpenWhisk: Where Did My Servers Go?

@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

Page 7: OpenWhisk: Where Did My Servers Go?

@csantanapr

Function-as-a-Service

Page 8: OpenWhisk: Where Did My Servers Go?

@csantanapr

SCALING: 0 to N

Page 9: OpenWhisk: Where Did My Servers Go?

@csantanapr

Pay as you go

Page 10: OpenWhisk: Where Did My Servers Go?

@csantanapr

Plenty of Providers

Page 11: OpenWhisk: Where Did My Servers Go?

@csantanapr

Compute Limits

flickr photo by zund https://flickr.com/photos/zund/12202485675 CC (BY-NC-ND) license

Page 12: OpenWhisk: Where Did My Servers Go?

@csantanapr

Debug/Test/Monitor

flickr photo by Thomas Hawk https://flickr.com/photos/thomashawk/4544013443 CC (BY-NC) license

Page 13: OpenWhisk: Where Did My Servers Go?

@csantanapr

Deployment Complexity

Page 14: OpenWhisk: Where Did My Servers Go?

@csantanapr

Frameworks

Page 15: OpenWhisk: Where Did My Servers Go?

@csantanapr

Isn’t this Paas?

Page 16: OpenWhisk: Where Did My Servers Go?

@csantanapr

OpenWhisk

OpenWhisk is a cloud platform that executes code

in response to events

OpenWhisk

Page 17: OpenWhisk: Where Did My Servers Go?

@csantanapr

OpenWhisk Use CasesServerless Web Application

Serverless Mobile Backend

Real-time data processing

Real-time Chatbot messaging

Scheduled Jobs

Page 18: OpenWhisk: Where Did My Servers Go?

@csantanapr

OpenWhisk = open source

Page 19: OpenWhisk: Where Did My Servers Go?

@csantanapr

Running locally

$ git clone github.com/openwhisk/openwhisk

$ cd openwhisk/tools/vagrant

$ ./hello

Page 20: OpenWhisk: Where Did My Servers Go?

@csantanapr

IBM Bluemix OpenWhisk

Page 21: OpenWhisk: Where Did My Servers Go?

@csantanapr

Programming Model

A Action:

A stateless, relatively short-running function invoked as an event handler.

AJSON Object JSON Object

Input OutputStateless Function

Page 22: OpenWhisk: Where Did My Servers Go?

@csantanapr

Programming Model

A function main(params) { console.log(“Hello “ + params.name); return { msg: “Goodbye “ + params.name) };}

OpenWhisk supports Node.js 6

Page 23: OpenWhisk: Where Did My Servers Go?

@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.

Page 24: OpenWhisk: Where Did My Servers Go?

@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

Page 25: OpenWhisk: Where Did My Servers Go?

@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.

Page 26: OpenWhisk: Where Did My Servers Go?

@csantanapr

Execution Model

Pool of actions

Swift DockerJS

Trigger1

Running action

Running action

Running action

3

OpenWhisk Engine

2 A

T

AAA

Page 27: OpenWhisk: Where Did My Servers Go?

@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

Page 28: OpenWhisk: Where Did My Servers Go?

@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

Page 29: OpenWhisk: Where Did My Servers Go?

@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

Page 30: OpenWhisk: Where Did My Servers Go?

@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

Page 31: OpenWhisk: Where Did My Servers Go?

@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

Page 32: OpenWhisk: Where Did My Servers Go?

@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

Page 33: OpenWhisk: Where Did My Servers Go?

@csantanapr

DarkVision

https://github.com/IBM-Bluemix/openwhisk-darkvisionapp

Page 34: OpenWhisk: Where Did My Servers Go?

@csantanapr

Skylink

https://github.com/IBM-Bluemix/skylink

Page 36: OpenWhisk: Where Did My Servers Go?

@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

Page 37: OpenWhisk: Where Did My Servers Go?

@csantanapr

Join Us!

github.com/openwhisk

@OpenWhisk

bluemix.net/openwhisk

slack.openwhisk.org

StackOverflow tagged =>openwhisk

Openwhisk.org