mobile and serverless : an untold story

Post on 21-Jan-2018

173 Views

Category:

Presentations & Public Speaking

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

MobileandServerless :AnuntoldStory

VidyasagarMachupalliTechnicalproductManager,IBMCloud

AboutMe

• Polyglot and Pragmatic Programmer

• @VidyasagarMSC

• http://vmac.xyz

IBMBLUEMIXOPENWHISKISNOW IBMCLOUDFUNCTIONS

IBM Cloud FunctionsEvolutionofserverlessIn

crea

sing

focu

s on

bus

ines

slo

gic

VM VM

VM

Virtual machines

Bare Metal

Decreasing concern (and control) over stack implementation

Functions

Containers

What is serverless aka Functions as a Service?

IBM Cloud FunctionsWhat is serverless aka Functions as a Service?

Runs code only on-demand on a per-request basis

IBM Cloud Functions

Runs code only on-demand on a per-request basis

Serverless deployment & operations model

VM

No servers Just code

What is serverless aka Functions as a Service?

IBM Cloud Functions

Runs code only on-demand on a per-request basis

“Serverless is for compute what object storage is for storage”

VM

No servers Just code

What is serverless aka Functions as a Service?

IBM Cloud Functions

Runs code only on-demand on a per-request basis

Optimal utilization & granular pricing

zzz

timecharged

What is serverless aka Functions as a Service?

IBM Cloud Functions

Runs code only on-demand on a per-request basis

Scales ona per-request basis

What is serverless aka Functions as a Service?

IBM Cloud Functions

Why is serverless better than a traditional approach?

IBM Cloud FunctionsWhyisserverlessbetterthanatraditional approach?

CF Container VM

2Application

1a

Requests

1b

Polling

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

IBM Cloud Functions

Trigger

1

2OpenWhisk Engine

Pool ofActions

Js Swift

Java Docker Python

Running Action

Running Action

Running Action

3

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

Whyisserverlessbetterthanatraditional approach?

IBM Cloud Functions

What isIBM Cloud Functions?

IBM Cloud FunctionsWhatisIBMCloud Functions?

Functions as a Service (FaaS) platform to execute code in response to events

IBM Cloud Functions

FaaS platform to execute code in response to events

Delivered asOpen source via Apacheopenwhisk.incubator.apache.org

What is IBM Cloud Functions?

IBM Cloud Functions

FaaS platform to execute code in response to events

Managed service on IBM Cloud ibm.biz/functions

What is IBM Cloud Functions?

IBM Cloud Functions

Triggers (response)

Actions (code)

Rules

Source (events) Results

WhatisIBMCloud Functions?

IBM Cloud Functions

Supported Languages

Multi-language

Support

CommunityEfforts

… and more to come

JS/NodeJS 6

Java

Python 3

Swift 3

Docker

Haskell Scala

What is IBM Cloud Functions?

PHP NEW

…Cobol

IBM Cloud Functions

Blocking

Non-blocking

Periodic

Supportfordifferent invocationmodels

What is IBM Cloud Functions?

IBM Cloud Functions

Supports higher-level programming constructs Chaining/

Sequencing

Action 1

Action 2

Parameter Binding

Default Parameters

Default Name

Default Value

What is IBM Cloud Functions?

IBM Cloud Functions

EventProvider

Open event emitter (consumer ecosystem)

Open interface for event emitters

What is IBM Cloud Functions?

IBM Cloud Functions

EventProvider Periodic IBM Cloudant Message Hub

Mobile Push Github IBM App Connect

What is IBM Cloud Functions?

IBM Cloud Functions

Granular Pricing

WhatisIBMCloud Functions?

Memory allocated (MB)

Time executing (milliseconds)

Instances executing simultaneously (count)

IBM Cloud Functions

Allows to package all puzzle pieces of a server less application into a single project and deploy it in a vendor-agnostic way.

Improved ServerlessFramework support

What is IBM Cloud Functions?

IBM Cloud Functions

What is serverless good for?

IBM Cloud Functions

IBM Cloud Functions allows you to build up an entirely serverless application architecture

Openwhisk

IOT

Mobile

Cognitive

APIs

Data

What is serverless good for?

Functions

IBM Cloud Functions

Volatile workload that can be split in smaller short-running pieces.

Suited for sporadic as well as heavy load scenarios.

Whatisserverlessgood for?

IBM Cloud Functions

API Gateway supportAllows to map API endpoints to Cloud Functions actions

Serverless microservice APIs/backend

Available for free, without limits

Define API Endpoints (URLs) and map to Actions Define Actions: getCustomer createCustomerdeleteCustomer

1

Get: mydomain.com/…/customers Post: mydomain.com/…/customers Delete: mydomain.com/…/customers

2

What is serverless good for?

IBM Cloud FunctionsgetCostumercreateCostumerdeleteCostumer

3Easy to add and edit:Security (API key, API secret, OAuth validation, CORS) Rate-LimitingMap actions to API endpoints (OpenAPI Doc creation) Easy socialization (sharing, API key creation) Analytics (API calls, errors, response time)Test your API (API Explorer) Upload Swagger/OpenAPI Doc

2 1

Whatisserverlessgood for?

IBM Cloud Functions

Use cases• Web and Mobile backend

• Data Processing

• Cognitive

• IoT

• Scheduled Tasks

• Chatbots

What is serverless good for?

NewsWatch• AusersubscribestoaNEWStagandyoucanpushnotificationbypollingNEWSAPIsaroundthe

world.

• TheNEWSisreadoutusingWatsonTexttoSpeech.

• Showcasing– PushNotifications– WatsonTexttoSpeech– OpenWhisk (SwiftAction)

2017/18

SmartFollow-up

• Feedbackprovidedbyashoppe isfedtoWatsonToneanalyzertoanalyzethetoneofthefeedbackwhichindeedhelpsthecustomertounderstandthemoodoftheuser.

• Basedonthetonereturnedapushnotificationwillbesenteitherthankingorchangingthemoodofthecustomerwithadiscount.

• Showcasing– PushNotifications– MobileFoundationonBluemix– Cloudant NoSQLDB– WatsonToneAnalyzer– OpenWhisk

NearBY• Atraveller-friendlyappshowingthenearby

restaurants(basedonoccasion),spasandcasinos.

• Sendsapushnotificationiftheuserentersanewlocation.

• Showcasing– PushNotifications– MobileAnalytics– Kitura talkingtoGooglePlacesAPI– WatsonConversation– WatsonTexttoSpeech&SpeechtoText– OpenWhisk

DEMO

IBM Cloud Functions

How doesCloud Functions work?

IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?Apache OpenWhisk

Controller

…Invoker InvokerInvoker

IBM Cloud Functions

Cloudant

ELK-Stack

Controller

Integration Service

soon

…InvokerInvokerInvoker

Monitoring

IBM Cloud FunctionsHow does Cloud Functions work behind the scenes?

IBM Cloud

IBM Cloud Functions

Basically, OpenWhisk is based on Docker… but we added some smartness to meet our performance goals…

Behindthescenes:It’saboutcontainers

How does Cloud Functions work behind the scenes?

IBM Cloud Functions

Awsk action invoke docker run

=≈

How does Cloud Functions work behind the scenes?

IBM Cloud Functions

Start containerdocker run

Initialize/init

Run/run

cold container

HowdoesCloudFunctionsworkbehindthe scenes?

IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?

Start containerdocker run

Initialize/init

Run/run

39

pre-warmed container

IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?

Start containerdocker run

Initialize/init

Run/run

warm container

IBM Cloud Functions

cold container pre-warmed container warm container

faster

Performance is king…HowdoesCloudFunctionsworkbehindthe scenes?

Q&A

top related