This document provides a summary of a presentation on patterns for mobile and IoT backends using serverless paradigms.
The presentation covers serverless computing on IBM Cloud Functions, introduces mobile services on IBM Bluemix, discusses IoT, and outlines several patterns discussed including: [1] mobile apps controlling processes, [2] processes triggering on mobile uploads/downloads, and [3] mobile notifications on events of interest.
Specific examples covered include perishable food transport monitoring using sensors and mobile approvals, employee expense reimbursement using mobile uploads and approvals, and remote patient monitoring using sensors and notifications.
Patterns for Mobile and IoT backends with serverless paradigms
1. Patterns for Mobile and
IOT backends with
serverless paradigms
Vidyasagar Machupalli,
Technical Offering Manager, IBM
@VidyasagarMSC
2. 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
4. 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.
5. 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
6. 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
7. 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
8. 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.
9. IBM Cloud University 2017 | October
On-Prem VMs Containers Serverless
Time to
provision
Weeks-
Months
Minutes Seconds-
Minutes
Milliseconds
Utilization Low High Higher Highest
Charging
granularity
CapEx Hours Minutes Blocks of
milliseconds
Developer
Responsibilities
business logic
service integrations
(declarative)
REST API definition
(declarative)
Platform Responsibilities
containers
middleware
autoscaling
load balancing
service discovery
fault tolerance
logging
messaging
security patches
Why Serverless?
10. IBM Cloud University 2017 | October
Examples – OpenWhisk Usages
Serverless Backend
Mobile Backend
Data Processing
Cognitive Data Processing
IoT Ready
11. 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
12. 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.
13. 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
14. 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
15. 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:
16. 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 performs
the 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 is
sent 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
17. 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 Gateway
4. Invoke Business
Action for route change
6. Notify Driver of
route change
Mobile Analytics Dash DB
Apache Spark
Message Hub Object Store
7. Data from sensor to MH
8. Transformed Data
9. Data from mobile and web channels
11. Combined Analysis
of Omni Channel data
10. Transformed sensor
data for further analysis
18. 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:
19. 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 Compute
Gaps : App ID Authenticate Action, App Access Offline Sync action
20. IBM Cloud University 2017 | October
App ID
Mobile SDK
Push Notification
Cloud
Functions
1.Authenticate
and obtain
token
2.Store image into object storage
8.Send claim status
5.Send for approval
7.Trigger Notification
3.Trigger on upload
Object Storage
Image
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
Action
App Access
9.Weekly Trigger for Timesheet update
11. Sync app data
10. Invoke App Sync
21. 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:
22. 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 reached
re-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 Compute
Gaps : Cognitive Engage – Update App Theme Action
23. IBM Cloud University 2017 | October
Custom actions
Mobile Gaps
Patient Care
7. Place reorder of
medicines
1. Data from 4 sensors
IOT
Platform
Action1
Action2
Action3
Action4
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 engagement
to change app UI
Cognitive Engage
10. Change app theme dynamically
Cloud
Functions
Push Notification
Message Hub
11. Control sensor
12. Transform message format13. Send Command to sensor
24. Scenario and Cloud Functions/IFTTT Components
temperature,
humidity
varies
abnormally
Notify
transport
company and
manufacturer
offers
alternate
routes
Supervisor
approves
or declines
Driver 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
loaded
Weather
Conditions
Run Washing
cycle
Monitor 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
25. 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
26. 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/ Triggers
BLUE - Mobile actions/Triggers
PURPLE – Cloud Functions
YELLOW - Third party APIs
27. 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
28. Countless capabilities
HYBRID CLOUD
IMPLEMENTATION
CLOUD & DATA
DESIGN
IDENTIFY
OPPORTUNITIES
DIRECTION &
SCOPE
BUSINESS
CASE
OPERATIONAL
MANAGEMENT
FRAMEWORK
GOVERNANCE &
ORGANZATION MODEL
CLOUD
TECHNICAL
SUPPORT
CLOUD NATIVE
SOLUTION
TRANSITION
WORKLOADS
UNLOCK DATAMANAGED
APPS
IBM Cloud
Professional
Services
IBM
Bluemix
Garage
IBM
Analytics
Services
3 practices
Services
immersed in
startup DNA
and the newest
technologies
Cloud Advisory
Services and
integrated
solutions for
hybrid cloud
Analytics-
based solutions
that empower
your data
5 principles
1. METHODOLOGY & ASSETS
We provide the most potent hybrid cloud
methodology and assets available.
2. DEEP SKILLS
We curate the most agile, deeply-skilled
expert teams in the industry.
3. FAST SUCCESS
We champion prescriptive, guided cloud
adoption journeys with adaptable
blueprints.
4. CONFIDENCE
We enable transformations by empowering
our clients.
5. WORLD-CLASS SUPPORT
We 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 expo
to talk about how we can help
30. IBM Cloud University 2017 | October
Notices and disclaimers
continued
Information 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.