patterns for mobile and iot backends with serverless paradigms

31
Patterns for Mobile and IOT backends with serverless paradigms Vidyasagar Machupalli, Technical Offering Manager, IBM @VidyasagarMSC

Upload: vidyasagar-machupalli

Post on 21-Jan-2018

98 views

Category:

Technology


0 download

TRANSCRIPT

Patterns for Mobile andIOT backends withserverless paradigmsVidyasagar Machupalli,Technical Offering Manager, IBM@VidyasagarMSC

IBM Cloud University 2017 | October

• A quick intro to Serverless Computing (IBM Cloud Functions).• A short intro to our Mobile services on IBM Bluemix.• IoT – Internet of everyThing.• Jump right into the patterns.

Agenda

IBM Cloud University 2017 | October

To Summarize

IBM Cloud University 2017 | October

Serverless Architecture/Computing

§ Serverless Computing allows you to build and run applications and services without having to manage infrastructure

§ It is cloud computing execution model in which the cloud provider dynamically manages the allocation of machine resources.

IBM Cloud University 2017 | October

Serverless Architecture/Computing

§ You no longer have to provision, scale, and maintain servers to run your applications, databases, and storage systems.

§ Most serverless vendors offer compute runtimes, also known as function as a service (FaaS) platforms, which execute application logic

§ With Serverless Developers can focus more on code less on infrastructure

IBM Cloud University 2017 | October

Advantages of Serverless Computing that will help to transform application development§ Help to lower the cost of cloud

§ Serverless computing only executes a user’s functions in response to specific events determined by developers. It costs nothing when not in use, which means companies no longer need to have idle compute resources. Users pay only for the time it is running.

§ Enables intrinsic and simple growth§ Whether an app needs to run a thousand times a second or once a week, serverless computing

offers inherent scaling. Organizations no longer need to choose between purchasing infrastructure they may never use in order to handle unexpected growth instantly. A serverless architecture scales up or down in sync with demand.

§ Promotes the development of cognitive and IoT apps of the future§ Serverless platforms can be used to build a wide range of apps that can easily integrate with many

advanced technologies, such as cognitive intelligence and data analytics.Internet of Things apps and devices, mobile apps and cognitive chat bots are among the most popular apps on serverless platforms

IBM Cloud University 2017 | October

Emerging workloads that are fit for FaaS

§ Execute app logic in response to database change§ Schedule tasks according to a specific timetable such as taking

backups and log analysis§ Perform edge analytics in response to sensor input§ Invoke auto scalable mobile backend services§ Image processing coupled with Cognitive Visual Recognition

IBM Cloud University 2017 | October

IBM Cloud Functions

A Cloud Platform that execute code on demand in a highly scalable, serverless environment.

§ IBM Cloud Functions is a Function-as-a-Service (FaaS) platform which executes functions in response to incoming events and costs nothing when not in use.

§ Cost-Effective Computing• Pay only for the exact time your actions run, down

to one-tenth of a second: no memory, no cost.§ Automatically Scale

• Run your action thousands of times in a fraction of a second, or once a week. Action instances scale to meet demand exactly, then disappear.

§ Easy Integration• Trigger your actions from events in your favorite

services, or directly via REST API.

IBM Cloud University 2017 | October

On-Prem VMs Containers ServerlessTime to provision

Weeks-Months

Minutes Seconds-Minutes

Milliseconds

Utilization Low High Higher Highest

Charging granularity

CapEx Hours Minutes Blocks of milliseconds

DeveloperResponsibilitiesbusiness logicservice integrations

(declarative)REST API definition

(declarative)

Platform Responsibilitiescontainersmiddlewareautoscalingload balancingservice discoveryfault toleranceloggingmessagingsecurity patches

Why Serverless?

IBM Cloud University 2017 | October

Examples – OpenWhisk Usages

Serverless Backend

Mobile Backend

Data Processing

Cognitive Data Processing

IoT Ready

IBM Cloud University 2017 | October

NewsWatch• A user subscribes to a NEWS tag and you can push notification by polling NEWS APIs

around the world. • The NEWS is read out using Watson Text to Speech.

• Showcasing• Push Notifications • Watson Text to Speech• IBM Cloud Functions

2017/18

IBM Cloud University 2017 | October

Smart Follow-up • Feedback provided by a shoppe is fed to Watson Tone analyzer to analyze the

tone of the feedback which indeed helps the customer to understand the mood of the user.

• Based on the tone returned a push notification will be sent either thanking or changing the mood of the customer with a discount.

• Showcasing • Push Notifications• Mobile Foundation on Bluemix• Cloudant No SQL DB• Watson Tone Analyzer• IBM Cloud Functions.

IBM Cloud University 2017 | October

NearBY• A traveller-friendly app showing the

nearby restaurants(based on occasion), spas and casinos.

• Sends a push notification if the user enters a new location.

• Showcasing• Push Notifications • Mobile Analytics• Kitura talking to Google Places API• Watson Conversation• Watson Text to Speech & Speech to Text• IBM Cloud Functions

IBM Cloud University 2017 | October

Emerging Patterns

Mobile Workloads are unpredictable, event based making it well suited for leveraging serverless technologies to build server side components of mobile applications. There have been repeatable patterns emerging for serverless paradigm involving mobile backend as seen from the customer usecases

ØPattern 1 : Mobile app as a process controllerØPattern 2 : Process Triggers upon uploads/download

through mobile (image, file etc)ØPattern 3 : Mobile Notification on events of interestØOther Interesting Patterns & Use Cases

IBM Cloud University 2017 | October

Pattern 1: Mobile app as a process controller

• With the proliferation of IOT there has been various scenario's where mobile apps control the process and sensor monitor various aspects of the process. For example:

IBM Cloud University 2017 | October

Perishable Food Product HandlingØUse case : A logistic company which transports perishable food products employs sensors in transport trucks in order

to detect environment temperature variations which is critical to its business. The transport company and manufacturer will be notified through their mobile app if there is any significant temperature & humidity changes, so that action can be taken to prevent any damages. The mobile app offers alternate routes. The authorized person can approve or decline route changes. He can even approve the delivery of goods to a nearby warehouse/retailer instead. This is notified to the driver who performsthe delivery.

Taking a step further, the logistic company wants to analyze the data both from sensors and mobile app to see if there is a correlation/pattern between the temperature changes and number of alternate route approvals that have taken place in order to cancel certain routes which have had reoccurring issues.

ØHigh Level Flow : IoT Platform processes events regarding temperature, humidity and the open whisk trigger is invoked to notify the transport company and the manufacturer, in case the values vary abnormally. Also, a silent notification issent to the mobile app upon which the app updates the alternate routes for this particular work handle. The mobile app now offers alternate routes. The authorized person can choose alternate route or approve delivery of goods to the nearest warehouse. Once approved the Whisk Notification action is triggered to notify the driver who performs the delivery.

The data from Real time sights of IOTP along with mobile analytics data from Mobile Analytics (exported to Dash db) is analyzed further with Apache Spark to find out patterns.

ØComponent Diagram:Services : Push Notifications, Mobile Analytics, IOT Platform, Object Store, Message Hub, Dash DB, Apache Spark, API Gateway, Cloud Functions Compute

IBM Cloud University 2017 | October

Cloud Functions

Custom actions

Mobile Gaps

Perishable Food Product Handling

1. Data from truck sensors

IOT Platform

Detect Temp Abnormality

2. Whisk actions trigged periodically to detect abnormality

3. Notify Supervisor

Approve Route

Change

5. Approve route change

Supervisor

Driver

Manufacturer

3. Notify Manufacturer

Push Notification

API Gateway4. Invoke Business Action for route change

6. Notify Driver of route change

Mobile Analytics Dash DB

Apache Spark

Message Hub Object Store7. Data from sensor to MH 8. Transformed Data

9. Data from mobile and web channels

11. Combined Analysisof Omni Channel data

10. Transformed sensor data for further analysis

IBM Cloud University 2017 | October

Pattern 2: Process Triggers upon uploads/download through mobile (image, file etc)• Triggering business processes based on

uploads/downloads from mobile is another key pattern which is well suited to be implemented using serverless. For example:

IBM Cloud University 2017 | October

Employee Claim ProcessingØUse case : Way2Work allows employees to submit their claims using mobile app. The employee logs in, creates a

reimbursement request and then uploads the image of the bills. This process is instantaneous and claims submission is just a click away rather than a time consuming process. He/She is notified once the reimbursement request is accepted and processed. Way2Work Employees also fill timesheets everyday, but needs to update to the server once a week. In order to conserve bandwidth the company wants the timesheet sync to happen only once a week.

ØHigh Level Flow : Way2Work uses Whisk based architecture inorder to process such requests since the volume of such claims is unpredictable. The user login triggers an AppID action to authenticate the user to obtain an authentication token. Every time a reimbursement request is submitted the attachment is stored in Object Storage. OpenWhisk triggers an image processor microservice on Bluemix to perform OCR of the image and add the reimbursement total from all images. A custom whisk action is invoked which sends the request to his manager for approval. Once approved, a notification is sent to the employee about the status of the reimbursement. For time sheet capability, the app only provides an offline timesheet filling capability. On the server side a cron job is invoked every week which automatically sync’s the app data to the server.

ØComponent Diagram and Mobile Backend Gaps :Services : App ID, Object Storage, Push Notifications, Open Whisk ComputeGaps : App ID Authenticate Action, App Access Offline Sync action

IBM Cloud University 2017 | October

App ID

Mobile SDK

Push NotificationCloud Functions

1.Authenticate and obtain token

2.Store image into object storage

8.Send claim status5.Send for approval

7.Trigger Notification

3.Trigger on upload

Object StorageImage

Processor

Manager Approval

Action

4.Process image & send total amount back

6. Get approval status

Third party service

Custom Action

Mobile Gaps

Employee Claim Processing

Timesheet Sync Invoke

ActionApp Access

9.Weekly Trigger for Timesheet update

11. Sync app data 10. Invoke App Sync

IBM Cloud University 2017 | October

Pattern 3: Mobile Notification on events of interest

• The most common pattern is the notification upon events of interest. For example:

IBM Cloud University 2017 | October

Patient CareØUse case : A senior care app monitors remote senior citizens through various sensors like temperature, air quality, water

detection, movement & heart sensors. If anything abnormal is detected like high temperature, decreased movement or abnormal heart rate, a notification is sent to the nearby health provider to send immediate help. A relative can monitor & control the sensor’s (reducing the A/C) using the mobile app.

When a patient misses taking a medicine, the patient, relative and doctor will be notified. If the medicine level has reachedre-order level, the app automatically places an order with the nearby pharmacy store or notifies relative.A new sensor can be added at the patient side. The app theme should be automatically changed to show the details of the new sensor

ØHigh Level Flow : The data from the different sensors flows through the IOT platform. Whisk actions are triggered if any value is not in normal range. A relative can control the sensors though the app. Also, the sensors on the medicines shows real time usage and the app automatically places an order from nearby store. When a new sensor is added the app invokes an engagement from Engage service to change app theme dynamically

ØComponent Diagram and Mobile Backend Gaps :Services : Push Notifications, IOT Platform, Cognitive Engage, Open Whisk ComputeGaps : Cognitive Engage – Update App Theme Action

IBM Cloud University 2017 | OctoberCustom actions

Mobile Gaps

Patient Care

7. Place reorder of medicines

1. Data from 4 sensors

IOT Platform Action 1

Action 2

Action 3

Action 4

2. Whisk actions trigged periodically to detect abnormality

3. Notify Relative/ Hospital

4. Data from medicine level sensor

Level check and

notify

5. Check level

6. Notify relative to reorder with location

8. New sensor detection

New sensor check and update app

9. Detect and invoke engagementto change app UI

Cognitive Engage10. Change app theme dynamically

Cloud Functions

Push Notification

Message Hub

11. Control sensor

12. Transform message format13. Send Command to sensor

Scenario and Cloud Functions/IFTTT Components

temperature, humidity varies

abnormally

Notify transport

company and manufacturer

offers alternate

routes

Supervisor approves

or declinesDriver Notified

Patient monitored with

various sensors -Anomaly detected

Insurance notified directly

Notify Relatives, Hospital

Sends location for Ambulance

Notify Hospital

about past allergies

City's Electric grid is least

loadedWeather

ConditionsRun Washing

cycleMonitor closely

or provide firmware update

Notify operator on his Mobile

thro SMS

IoT based Whisk trigger

Mobile backend based Whisk action

Custom Whisk action

IOT based Whisk action

Transport of Perishable Goods

Industrial washing machine

IFTTT Trigger with Maker channel

Patient Monitoring for an Insurance Company

Scenario and Cloud Functions/IFTTT Components

User goes outside of a geo- fence Alert User that is not a safe area

Thief Breaks in. Capture Picture Notify Owner Notify Nearby

Police Station

Turn On Philips Hue(IFTTT) Lights Play

Siren

Higher chance of Precipitation Notify Farmer Turn Off Water

Sprinklers

IoT based Whisk trigger

Mobile backend based Whisk action

Custom Whisk action

IOT based Whisk action

IFTTT Trigger with Maker channel

Women Safety

Agriculture Insights

Home Safety

IBM Cloud University 2017 | October

Other UsecasesØ An industrial washing machine runs the cycle when the city's grid is least loaded

based on past grid status and weather conditions and send notification upon completion.

Ø When the weather insights gives a higher chance of precipitation in an area, ask the farmer if he wants to turn off the water sprinklers in an agriculture farm.

Ø Based on external temperature and weather conditions, tune the thermostat of all the buildings in the area and notify the building administrator.

RED - IoT actions/ TriggersBLUE - Mobile actions/TriggersPURPLE – Cloud FunctionsYELLOW - Third party APIs

IBM Cloud University 2017 | October

See you here

11:45 to 12:45 | Chess - Build an Omnichannel app with Mobile capabilities on Bluemix

15:15 to 16:15 | Kopernick II, III- Building Enterprise enabled Cognitive Mobile applications for a Hybrid Cloud Environment

Countless capabilities

HYBRID CLOUD IMPLEMENTATION

CLOUD & DATA DESIGN

IDENTIFYOPPORTUNITIES

DIRECTION & SCOPE

BUSINESSCASE

OPERATIONAL MANAGEMENT FRAMEWORK

GOVERNANCE & ORGANZATION MODEL

CLOUD TECHNICAL SUPPORT

CLOUD NATIVE SOLUTION

TRANSITIONWORKLOADS

UNLOCK DATAMANAGED APPS

IBM Cloud Professional Services

IBM Bluemix Garage

IBM Analytics Services

3 practicesServices immersed in startup DNAand the newesttechnologies

Cloud AdvisoryServices and integrated solutions for hybrid cloud

Analytics-based solutions that empower your data

5 principles1. METHODOLOGY & ASSETS

We provide the most potent hybrid cloud methodology and assets available.

2. DEEP SKILLSWe curate the most agile, deeply-skilled expert teams in the industry.

3. FAST SUCCESSWe champion prescriptive, guided cloud adoption journeys with adaptable blueprints.

4. CONFIDENCEWe enable transformations by empowering our clients.

5. WORLD-CLASS SUPPORTWe deliver world-class support to make sure you succeed.

It’s not just about building a cloud infrastructure –it’s about strategically adopting cloud to realize its benefits

Stop by the Services Booth in the expoto talk about how we can help

IBM Cloud University 2017 | October

Notices and disclaimersCopyright © 2017 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM.

U.S. Government Users Restricted Rights — use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM.

Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. This document is distributed “as is” without any warranty, either express or implied. In no event shall IBM be liable for any damage arising from the use of this information, including but not limited to, loss of data, business interruption, loss of profit or loss of opportunity. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided.

IBM products are manufactured from new parts or new and used parts. In some cases, a product may not be new and may have been previously installed. Regardless, our warranty terms apply.”

Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.

Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and

the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.

References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business.

Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.

It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actionsthe customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law.

IBM Cloud University 2017 | October

Notices and disclaimers continuedInformation concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM expressly disclaims all warranties, expressed or implied, including but not limited to, the implied warranties of merchantability and fitness for a particular, purpose.

The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right.

IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™, FASP®, FileNet®, Global Business Services®,Global Technology Services®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®, StoredIQ, Tealeaf®, Tivoli® Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.

IBM Cloud University 2017 | October

Thank You