mobile and serverless : an untold story

46
Mobile and Serverless : An untold Story Vidyasagar Machupalli Technical product Manager, IBM Cloud

Upload: vidyasagar-machupalli

Post on 21-Jan-2018

171 views

Category:

Presentations & Public Speaking


0 download

TRANSCRIPT

Page 1: Mobile and Serverless : an Untold Story

MobileandServerless :AnuntoldStory

VidyasagarMachupalliTechnicalproductManager,IBMCloud

Page 2: Mobile and Serverless : an Untold Story

AboutMe

• Polyglot and Pragmatic Programmer

• @VidyasagarMSC

• http://vmac.xyz

Page 3: Mobile and Serverless : an Untold Story

IBMBLUEMIXOPENWHISKISNOW IBMCLOUDFUNCTIONS

Page 4: Mobile and Serverless : an Untold Story

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

Page 5: Mobile and Serverless : an Untold Story

What is serverless aka Functions as a Service?

Page 6: Mobile and Serverless : an Untold Story

IBM Cloud FunctionsWhat is serverless aka Functions as a Service?

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

Page 7: Mobile and Serverless : an Untold Story

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?

Page 8: Mobile and Serverless : an Untold Story

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?

Page 9: Mobile and Serverless : an Untold Story

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?

Page 10: Mobile and Serverless : an Untold Story

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?

Page 11: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Why is serverless better than a traditional approach?

Page 12: Mobile and Serverless : an Untold Story

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

Page 13: Mobile and Serverless : an Untold Story

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?

Page 14: Mobile and Serverless : an Untold Story

IBM Cloud Functions

What isIBM Cloud Functions?

Page 15: Mobile and Serverless : an Untold Story

IBM Cloud FunctionsWhatisIBMCloud Functions?

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

Page 16: Mobile and Serverless : an Untold Story

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?

Page 17: Mobile and Serverless : an Untold Story

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?

Page 18: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Triggers (response)

Actions (code)

Rules

Source (events) Results

WhatisIBMCloud Functions?

Page 19: Mobile and Serverless : an Untold Story

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

Page 20: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Blocking

Non-blocking

Periodic

Supportfordifferent invocationmodels

What is IBM Cloud Functions?

Page 21: Mobile and Serverless : an Untold Story

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?

Page 22: Mobile and Serverless : an Untold Story

IBM Cloud Functions

EventProvider

Open event emitter (consumer ecosystem)

Open interface for event emitters

What is IBM Cloud Functions?

Page 23: Mobile and Serverless : an Untold Story

IBM Cloud Functions

EventProvider Periodic IBM Cloudant Message Hub

Mobile Push Github IBM App Connect

What is IBM Cloud Functions?

Page 24: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Granular Pricing

WhatisIBMCloud Functions?

Memory allocated (MB)

Time executing (milliseconds)

Instances executing simultaneously (count)

Page 25: Mobile and Serverless : an Untold Story

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?

Page 26: Mobile and Serverless : an Untold Story

IBM Cloud Functions

What is serverless good for?

Page 27: Mobile and Serverless : an Untold Story

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

Page 28: Mobile and Serverless : an Untold Story

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?

Page 29: Mobile and Serverless : an Untold Story

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?

Page 30: Mobile and Serverless : an Untold Story

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?

Page 31: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Use cases• Web and Mobile backend

• Data Processing

• Cognitive

• IoT

• Scheduled Tasks

• Chatbots

What is serverless good for?

Page 32: Mobile and Serverless : an Untold Story

NewsWatch• AusersubscribestoaNEWStagandyoucanpushnotificationbypollingNEWSAPIsaroundthe

world.

• TheNEWSisreadoutusingWatsonTexttoSpeech.

• Showcasing– PushNotifications– WatsonTexttoSpeech– OpenWhisk (SwiftAction)

2017/18

Page 33: Mobile and Serverless : an Untold Story

SmartFollow-up

• Feedbackprovidedbyashoppe isfedtoWatsonToneanalyzertoanalyzethetoneofthefeedbackwhichindeedhelpsthecustomertounderstandthemoodoftheuser.

• Basedonthetonereturnedapushnotificationwillbesenteitherthankingorchangingthemoodofthecustomerwithadiscount.

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

Page 34: Mobile and Serverless : an Untold Story

NearBY• Atraveller-friendlyappshowingthenearby

restaurants(basedonoccasion),spasandcasinos.

• Sendsapushnotificationiftheuserentersanewlocation.

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

Page 35: Mobile and Serverless : an Untold Story

DEMO

Page 36: Mobile and Serverless : an Untold Story

IBM Cloud Functions

How doesCloud Functions work?

Page 37: Mobile and Serverless : an Untold Story

IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?Apache OpenWhisk

Controller

…Invoker InvokerInvoker

Page 38: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Cloudant

ELK-Stack

Controller

Integration Service

soon

…InvokerInvokerInvoker

Monitoring

IBM Cloud FunctionsHow does Cloud Functions work behind the scenes?

IBM Cloud

Page 39: Mobile and Serverless : an Untold Story

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?

Page 40: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Awsk action invoke docker run

=≈

How does Cloud Functions work behind the scenes?

Page 41: Mobile and Serverless : an Untold Story

IBM Cloud Functions

Start containerdocker run

Initialize/init

Run/run

cold container

HowdoesCloudFunctionsworkbehindthe scenes?

Page 42: Mobile and Serverless : an Untold Story

IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?

Start containerdocker run

Initialize/init

Run/run

39

pre-warmed container

Page 43: Mobile and Serverless : an Untold Story

IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?

Start containerdocker run

Initialize/init

Run/run

warm container

Page 44: Mobile and Serverless : an Untold Story

IBM Cloud Functions

cold container pre-warmed container warm container

faster

Performance is king…HowdoesCloudFunctionsworkbehindthe scenes?

Page 45: Mobile and Serverless : an Untold Story

Q&A

Page 46: Mobile and Serverless : an Untold Story