Download - Mobile and Serverless : an Untold Story
![Page 1: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/1.jpg)
MobileandServerless :AnuntoldStory
VidyasagarMachupalliTechnicalproductManager,IBMCloud
![Page 2: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/2.jpg)
AboutMe
• Polyglot and Pragmatic Programmer
• @VidyasagarMSC
• http://vmac.xyz
![Page 3: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/3.jpg)
IBMBLUEMIXOPENWHISKISNOW IBMCLOUDFUNCTIONS
![Page 4: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/4.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/5.jpg)
What is serverless aka Functions as a Service?
![Page 6: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/6.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/7.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/8.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/9.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/10.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/11.jpg)
IBM Cloud Functions
Why is serverless better than a traditional approach?
![Page 12: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/12.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/13.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/14.jpg)
IBM Cloud Functions
What isIBM Cloud Functions?
![Page 15: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/15.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/16.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/17.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/18.jpg)
IBM Cloud Functions
Triggers (response)
Actions (code)
Rules
Source (events) Results
WhatisIBMCloud Functions?
![Page 19: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/19.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/20.jpg)
IBM Cloud Functions
Blocking
Non-blocking
Periodic
Supportfordifferent invocationmodels
What is IBM Cloud Functions?
![Page 21: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/21.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/22.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/23.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/24.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/25.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/26.jpg)
IBM Cloud Functions
What is serverless good for?
![Page 27: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/27.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/28.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/29.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/30.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/31.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/32.jpg)
NewsWatch• AusersubscribestoaNEWStagandyoucanpushnotificationbypollingNEWSAPIsaroundthe
world.
• TheNEWSisreadoutusingWatsonTexttoSpeech.
• Showcasing– PushNotifications– WatsonTexttoSpeech– OpenWhisk (SwiftAction)
2017/18
![Page 33: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/33.jpg)
SmartFollow-up
• Feedbackprovidedbyashoppe isfedtoWatsonToneanalyzertoanalyzethetoneofthefeedbackwhichindeedhelpsthecustomertounderstandthemoodoftheuser.
• Basedonthetonereturnedapushnotificationwillbesenteitherthankingorchangingthemoodofthecustomerwithadiscount.
• Showcasing– PushNotifications– MobileFoundationonBluemix– Cloudant NoSQLDB– WatsonToneAnalyzer– OpenWhisk
![Page 34: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/34.jpg)
NearBY• Atraveller-friendlyappshowingthenearby
restaurants(basedonoccasion),spasandcasinos.
• Sendsapushnotificationiftheuserentersanewlocation.
• Showcasing– PushNotifications– MobileAnalytics– Kitura talkingtoGooglePlacesAPI– WatsonConversation– WatsonTexttoSpeech&SpeechtoText– OpenWhisk
![Page 35: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/35.jpg)
DEMO
![Page 36: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/36.jpg)
IBM Cloud Functions
How doesCloud Functions work?
![Page 37: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/37.jpg)
IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?Apache OpenWhisk
Controller
…Invoker InvokerInvoker
![Page 38: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/38.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/39.jpg)
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](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/40.jpg)
IBM Cloud Functions
Awsk action invoke docker run
=≈
How does Cloud Functions work behind the scenes?
![Page 41: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/41.jpg)
IBM Cloud Functions
Start containerdocker run
Initialize/init
Run/run
cold container
HowdoesCloudFunctionsworkbehindthe scenes?
![Page 42: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/42.jpg)
IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?
Start containerdocker run
Initialize/init
Run/run
39
pre-warmed container
![Page 43: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/43.jpg)
IBM Cloud FunctionsHowdoesCloudFunctionsworkbehindthe scenes?
Start containerdocker run
Initialize/init
Run/run
warm container
![Page 44: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/44.jpg)
IBM Cloud Functions
cold container pre-warmed container warm container
faster
Performance is king…HowdoesCloudFunctionsworkbehindthe scenes?
![Page 45: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/45.jpg)
Q&A
![Page 46: Mobile and Serverless : an Untold Story](https://reader034.vdocuments.us/reader034/viewer/2022051404/5a6489997f8b9a94568b4a2f/html5/thumbnails/46.jpg)