Top Banner
Service Assisted Device Communications on Microsoft Azure Rick G. Garibay MVP Microsoft Azure @rickggaaribay
55

Service Assisted Device Communications on Microsoft Azure

Jul 13, 2015

Download

Software

Rick G. Garibay
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Service Assisted Device Communications on Microsoft Azure

Service Assisted Device

Communications on Microsoft Azure

Rick G. Garibay

MVP Microsoft Azure

@rickggaaribay

Page 2: Service Assisted Device Communications on Microsoft Azure

About Me• VP, Distinguished Engineer leading the Development Platform Group at

Neudesic

• Working on IoT, Intelligent Transportation and Hospitality & Gaming

• 8-time Microsoft MVP, Microsoft Azure

• Co-Author, “Windows Server AppFabric Cookbook” by Packt Pub.

• Chairman, Co-Founder Phoenix Connected Systems User Group (PCSUG.org)

• twitter: @rickggaribay

• Official Hashtag: #azureconf

• blog: http://rickgaribay.net

• email: [email protected] | [email protected]

Page 3: Service Assisted Device Communications on Microsoft Azure

Agenda

• Internet of Things by the Numbers

• Devices, Protocols & Messaging Models

• IoT vs. “Things on the Internet”

• Service Assisted Communication on the Reykjavik Device Gateway

Page 4: Service Assisted Device Communications on Microsoft Azure

Internet of ThingsBy the numbers

Page 5: Service Assisted Device Communications on Microsoft Azure

There’s one thing analysts agree on

B5075212

Page 6: Service Assisted Device Communications on Microsoft Azure

OEM Revenue Opportunity | Market Forecast CY17

Source: IDC Sept 2013 and Microsoft

Auto & Trans Retail Manufacturing Healthcare Energy Computing Telecom Consumer

$7 B $16 B $197 B $3 B $27 B $908 B $179 B $356 B System Revenue

IntelligentSystems

1.7T$

Page 7: Service Assisted Device Communications on Microsoft Azure

The Internet of Things is the network of physical objects that contain embedded technology to communicate and interact with

their internal states or the external environment.

Page 8: Service Assisted Device Communications on Microsoft Azure

Devices, Protocols & Patterns

Page 9: Service Assisted Device Communications on Microsoft Azure

IoT Device Taxonomy

LargeLargeLargeLarge

MobileMobileMobileMobile

MicroMicroMicroMicro

SmallSmallSmallSmall

POS terminal, ATM, MRI

x86, PC-like, apps

Industry handheld, POS tablet

ARM and x86, shell experience, apps

Gateways, wearables, panels, cars

ARM and x86, diverse hardware, no shell

Controllers, fixed-use, sensors, actuators

ARM, constrained hardware, headless

Page 10: Service Assisted Device Communications on Microsoft Azure

5mm 5mm

Page 11: Service Assisted Device Communications on Microsoft Azure

Raspberry Pi

Page 12: Service Assisted Device Communications on Microsoft Azure

Intel Galileo

Page 13: Service Assisted Device Communications on Microsoft Azure

Arduino Uno

Page 14: Service Assisted Device Communications on Microsoft Azure

Netduino Plus 2

Page 15: Service Assisted Device Communications on Microsoft Azure

Gadgeteer Fez Spider

Page 16: Service Assisted Device Communications on Microsoft Azure

Beyond the garage, the true significance of IoT is the foundation it creates for providing insights and actions that enable new business capabilities.

Page 17: Service Assisted Device Communications on Microsoft Azure

Smart Products

Grid

Renewables

Oil/Gas/Coal Recovery and

Distribution

Pointsof Sale

Restaurants

Hotels

FuelStations

Patients

Clinics

Hospitals

NursingHomes

MobileCare

SafetySecurity

ComfortLighting

Automation

Manufacturing Integration and

AutomationRemote

Servicing

Predictive and Reactive

Maintenance

Water

Waste

PollutionControl

Fire

Emergency

PublicSafety

Law Enforcement

Letters

Packages

Containers

Tanks Bulkware

Games

Events

Sports

TelevisionStreaming

Traffic Buses

Cars

Trucks

Trains

Vessels

Aircraft

Bikes

Smart Energy

Smart Retail

Smart Mobility

Smart Logistics

Smart Factory

Smart Cities

Smart Entertain-

ment

Smart Health-

care

Smart Building Home

Page 18: Service Assisted Device Communications on Microsoft Azure

From IT to Operational Technology

IT

Servers, Applications, Systems

OT

Devices, Telemetry, Command & Control

Data-Driven Insight + Action at a Distance

Page 19: Service Assisted Device Communications on Microsoft Azure

Data Driven Insight + Action at a Distance

Data –> Information –> Insight ($+)

• Make more efficient use of resources

• Provide more targeted products and services

• Discover patterns, trends that lead to new business insights

Action at a Distance

• Acting on Data Insights (Real-Time and At Rest)

• The ability to act remotely –automatically and intelligently

• Remote control is a source of efficiency

• Enables new forms of customer interaction and engagement

19

Page 20: Service Assisted Device Communications on Microsoft Azure

Manufacturing: Consumer PRM

20

Insight

• Mineralization reads• # of daily work cycles• Flavor trends

Action

• Request permission to conduct descaling task

• Upsell to more robust model • New alliances, e-coupons,

etc.

Page 21: Service Assisted Device Communications on Microsoft Azure

Transportation : Smart Parking

21

Insight

• Vehicle ingress/egress from parking spot

• Meter payment• Meter expiry

Action

• Dynamic pricing adjustment based on parking saturation

• Extending meter time remotely via smart phone

• Directed enforcement of ticketing

Page 22: Service Assisted Device Communications on Microsoft Azure

Retail: Product Placement

22

Insight

• iBeacon signatures • Area/isle/product interaction• * Not just opt-in!

Action

• Triangulation• Customer Experience• Product placement

Page 23: Service Assisted Device Communications on Microsoft Azure

Message Types

Voluntary information flow from device to

another system.

Requests for information

from device to other systems.

Instructions from other

systems to a device.

Information flow from other systems to the

device.

Telemetry Inquires Commands Notifications

Page 24: Service Assisted Device Communications on Microsoft Azure

Various Protocols

2G

Wi-Fi

RFID

GPRS SMS

3G

LTE

WiMax

ZigBee

NFC

TCP

UDP

BLE

AMQP

MQTT

CoAP

Custom

HTTP

Page 25: Service Assisted Device Communications on Microsoft Azure

Default Connectivity Model

• Connectivity (IPv6 + VPN)• Give every device a routable IP address• Devices expose services for control/query operations• Command Source is either on premise or remote,

enabled by a bridge of some sort. • Remote access is enabled within the VPN’s routing

domain

Page 26: Service Assisted Device Communications on Microsoft Azure

Default Connectivity Model

Connections are command source

initiated.

Device exposes a service/API

Command Source

Page 27: Service Assisted Device Communications on Microsoft Azure

Default Connectivity Challenges• Addressability

• Requires network-layer intervention• Doesn’t work for devices that are loosely connected (roaming, frequently offline)

• Security• By default, every protocol that can be routed over Ethernet can flow – and between any two nodes• SSL/TLS is not an option on many small devices. • VPN controls access to IP addresses and ports, not application endpoints (lack of granular authorization)• Many devices are not VPN-capable due to resource/bandwidth constraints

• Efficient scale• VPN infrastructure is expensive and costly to maintain• Does not address device management.

• Think 1K, 10K, 100K+ devices

Page 28: Service Assisted Device Communications on Microsoft Azure

On-Premise Brokered Model

• Connectivity (IPv6 + VPN)• Give every device a routable IP address.• Devices participate in pub-sub messaging on-prem or

via VPN using industry standard protocol like MQTT.• Command Source is either on premise or remote,

enabled by a bridge of some sort. • Remote access is enabled within the VPN’s routing

domain.

Page 29: Service Assisted Device Communications on Microsoft Azure

On-Premise Brokered Model

Device subscribes to broker via TCP, etc.

Device Broker

Typically a socket connection.

Messaging happens on premise, attack surface minimized.

MQTT, etc.Command Source

Must be on premise or somehow bridged.

Page 30: Service Assisted Device Communications on Microsoft Azure

On-Premise Brokered Challenges• Addressability

• Device and broker are intimately connected.

• Doesn’t work for devices that are loosely connected (roaming, frequently offline).

• Security• SSL/TLS is not an option on many small devices.

• Many devices are not VPN-capable due to resource/bandwidth constraints.

• Efficient scale• VPN infrastructure is expensive and costly to maintain.

• External commands require some kind of a gateway service.

• Does not address device management.

• Think 1K, 10K, 100K+ devices

Page 31: Service Assisted Device Communications on Microsoft Azure

Service Assisted Communications Model

• Devices connect via open standard protocols• AMQP 1.0 and HTTP supported natively by the Service Bus

• MQTT, CoAP and others can be implemented via custom gateway/adapter model

• Sockets secured via TLS (or a lightweight variant)

• Each device has a dedicated Inbox/Outbox on the Gateway• Device sends telemetry/alerts and routes service invocations via its Outbox

• Device receives commands and queries from its Inbox

• Correlated request/reply patterns can be implemented on top of these two messaging channels

• The device knows, and has access to, only its own specific inbox/outbox endpoints (URI’s)

Backend Components

Cloud Gateway

Inbox

Outbox

Co

mm

and

AP

I

Pro

toco

l H

ead

Device

Page 32: Service Assisted Device Communications on Microsoft Azure

Service-Assisted Communications

Connections are device-initiated and

outbound

NAT/Firewall Device (Router)

IP NAT

Cloud Gateway

Command Source

Port mapping is automatic, outbound

Device does not listen for unsolicited

traffic

No inbound ports open, attack surface

is minimized

Access-controlled command API

Secure, managed hosting platform

Outbound

DNSmyapp.cloudapp.net

Page 33: Service Assisted Device Communications on Microsoft Azure

Telemetry Routing with the Azure Service Bus

� Split the stream

� Enable parallel processing

� Implement different Q QoS levels

� Level and balance the load

Topic SubsFilters

Service Bus

Device 2

Receiver 2b

Device 1

Device 3Receiver 2a

Alerts

Data

Receiver 1Alert Processor

StoragePre-processor

Page 34: Service Assisted Device Communications on Microsoft Azure

Routing Commands with the Azure Service Bus

TopicSubs Filters

Service Bus

Device 2

Device 1

Device 3Sender 2

Model A

Device 3

Sender 1

Model TModel T

Model A

� Target individuals or groups

� Set delivery timeouts (TTL)

� Deal with spotty connectivity

� Traverse NATs/firewalls securely

Page 35: Service Assisted Device Communications on Microsoft Azure

Event Hub for IoT: Big Data Ingestion

Event Sources Cloud Services

Storage & Analytics

Custom Code & 3rd Party Services

Web/Mobile User Interfaces

Integration Services

Event Hub

- Hyper Scale -

- Fully Managed -

- Interoperable -

- Secure -

- Cost Effective -

Page 36: Service Assisted Device Communications on Microsoft Azure

DEMODEMODEMODEMO 1111Device-Direct Commands over Azure Service Bus Queues

Page 37: Service Assisted Device Communications on Microsoft Azure

Service Assisted Custom/Cloud Gateway Challenges• Device Provisioning

• From a handful to thousands of devices• Self-service, scripted, automated

• Connectivity• Addressability (non-IP devices, firewalls/NATs, online/offline, roaming)• Heterogeneity (OS/firmware, power/network constraints, protocols)• Security (identity, authorization, privacy, data integrity)• Efficient Scale (millions of devices per tenant, at a reasonable cost)

• Messaging• Telemetry (collection, filtering, routing, throughput, per-message QoS)• Notifications (targeting devices/device groups within large populations)• Command/Query and Inquiries (correlation, sessions/batching)

Page 38: Service Assisted Device Communications on Microsoft Azure

IoT Cloud Platform “Stack” – Abstract Model

Non-IPCapable Devices

IPCapable Devices C

lou

d G

ate

way

Custom Code

Clo

ud

Pla

tfo

rm

Serv

ices

EnterpriseSystems

Third-Party Data and Services

A B C D E F

Fie

ld

Gate

way

Page 39: Service Assisted Device Communications on Microsoft Azure

Azure Hosting Options

Non-IPCapable Devices

IPCapable Devices C

lou

d G

ate

way

Custom Code

Clo

ud

Pla

tfo

rm

Serv

ices

EnterpriseSystems

Third-Party Data

and Services

A B C D E F

Web Sites

Mobile Services Cloud Services

External Code

VM Roles

Fie

ld

Gate

way

Page 40: Service Assisted Device Communications on Microsoft Azure

Azure Platform Services

Non-IPCapable Devices

IPCapable Devices C

lou

d G

ate

way

Custom Code

Clo

ud

Pla

tfo

rm

Serv

ices

EnterpriseSystems

Third-Party Data and Services

A B C D E F

HD Insight

Azure Databases

Table/Blob Storage

BizTalk Services

Service Bus

Fie

ld

Gate

way

Media Services

Page 41: Service Assisted Device Communications on Microsoft Azure

Azure – IoT Cloud Gateway

Non-IPCapable Devices

IPCapable Devices C

lou

d G

ate

way

Custom Code

Clo

ud

Pla

tfo

rm

Serv

ices

EnterpriseSystems

Third-Party Data

and Services

Fie

ld

Gate

way

A B C D E FA B C D

Serv

ice B

us

A/B

Serv

ice B

us

A/B

Cu

sto

mG

W R

ole

Pattern 1: Device Direct Pattern 2: Custom Gateway

Page 42: Service Assisted Device Communications on Microsoft Azure

Service Assisted CommunicationsOn the Azure Cloud Gateway Accelerator – Code Name Reykjavik

Page 43: Service Assisted Device Communications on Microsoft Azure

Service Bus Messaging

Device Gateway Accelerator – Reference Architecture (Reykjavík)

1. Custom Protocol Gateway

2. Telemetry Pump and Adapters

3. Command Gateway

4. Provisioning Service and Metadata Store

Custom Protocol Gateway Host

MQTT CoAP …

Telemetry/Request Router

Notification/CommandRouter

Adapters Command API Host

Provisioning Service

Device Metadata and Key

Store

HD

Insi

gh

t

Biz

Talk

Orl

ean

s

Azu

re S

tora

ge

Azu

re D

bs

Serv

ice B

us HTTP

HTTP

Devices

AMQP

1

2 3

4

Configuration

HTTP

Yo

ur

Pro

cess

Page 44: Service Assisted Device Communications on Microsoft Azure

Device (Non-ISS)

Device (Non-ISS)

Event Hub

Azure Storage

Rich Device Registry & Object Model of “Things”

Azure

ISS

Customer Apps

HDInsights

BI Systems

3rd Party Solutions

Data Flow

Intelligent Systems Service (LP)

SQL Azure

Event Hub

Basic Device

Registry

ISS S

ecu

rity

, P

riva

cy &

Sh

ari

ng

Co

ntr

ols

IoT Rule Templates

Natural Language Query

ISS Agents

ISS Agents

ISS Agents

ISS Solution

Sin

gle

Acc

ou

nt,

Per

devi

ce B

illin

g,

etc

.

Command & Control

Azure Event Processing

ISS

Po

rtal

Page 45: Service Assisted Device Communications on Microsoft Azure

Device Gateway – Partition Topology

• The “Partition” is a set of resources dedicated to a specific device population (or subset thereof).

• The “Master” role manages partition deployment and device provisioning into the partitions.

PartitionMaster

Partition Repo

Command Topics

Service Bus Standard Protocol Custom Protocol

Device Repoin0000 inFFFF…in0001 in0002

AMQP HTTP MQTT Custom Protocol Host

Protocol Adapters

diagall diagall diagall diagall

Telemetry Pump/Router

N Instances

Telemetry Adapter

Telemetry Adapter

Telemetry Adapter

DeploymentRuntime

out0000 outFFFF…out0001 out0002

s0001

s0002

s03E7

s0001

s0002

s03E7

s0001

s0002

s03E7

s0001

s0002

s03E7

g0000/rte0000

g0000/rte0001

ou

t0

ou

t1

ou

t2

n Groups of m Routers

ou

t0

ou

t1

ou

t2

g0001/rte0000

g0001/rte0001

ou

t0

ou

t1

ou

t2

ou

t0

ou

t1

ou

t2

ProvisioningRuntime

Ingestion Topics or Event Hubs (Telemetry)

CommandAPI Host

Page 46: Service Assisted Device Communications on Microsoft Azure

DEMO 2 DEMO 2 DEMO 2 DEMO 2 –––– REYKJAVIK SNEAK PEAK!REYKJAVIK SNEAK PEAK!REYKJAVIK SNEAK PEAK!REYKJAVIK SNEAK PEAK!Reykjavik Device Gateway Deployment and Provisioning

Page 47: Service Assisted Device Communications on Microsoft Azure

Device Gateway – Customer Topology

• Global coverage achieved by spreading partitions across multiple Azure regions

• Reference architecture supports up to 1000 distinct partitions

• Number and distribution of partitions driven by data volumes, business continuity, legal and proximity considerations

Page 48: Service Assisted Device Communications on Microsoft Azure

Consumer: Space Heater

48

Insight

• Current Temperature• Current Fan Speed• Current Fan RPM

Action

• Increase/reduce fan speed• Change temperature• Change readings interval

Page 49: Service Assisted Device Communications on Microsoft Azure

DEMO 3 DEMO 3 DEMO 3 DEMO 3 ---- REYKJAVIK SNEAK REYKJAVIK SNEAK REYKJAVIK SNEAK REYKJAVIK SNEAK PEAK!PEAK!PEAK!PEAK!Reykjavik Device Gateway Telemetry & Commands

Page 50: Service Assisted Device Communications on Microsoft Azure

Event Velocity

Device telemetry• Thermostats report data

every 15 minutes

• Cars send telemetry data every minute

Application telemetry• Application perf counters are measured

every second per server

• Mobile app telemetry is captured for every action on your app!

App and operational events• Halo game engine estimate 1,000,000

messages/second

Page 51: Service Assisted Device Communications on Microsoft Azure

Protocol reach to devices and platforms

Windows

Azure Service Bus

Queues

Topics

Event hubs

/azure-sdk-for-python/

/azure-sdk-for-php/

/azure-sdk-for-node/

/azure-sdk-for-java/

/azure-sdk-for-ruby/

HTTP(S)HTTP(S)HTTP(S)HTTP(S)

https://github.com/windowsAzureAMQP 1.0

Other platforms

AMQP AMQP AMQP AMQP 1.01.01.01.0

EmbeddedEmbeddedEmbeddedEmbedded

Page 52: Service Assisted Device Communications on Microsoft Azure

Event Hub Pub-Sub Ingestion

FacetFacetFacetFacet ServiceServiceServiceService Bus Event Hub CapabilityBus Event Hub CapabilityBus Event Hub CapabilityBus Event Hub CapabilityVariety: > million publishers with HTTP/AMQPVelocity: > million EventData data ingress/secondVolume: > GB/s ingress, concurrent consumersSecurity: SAS based, unique token per publisherBuffer: Consumer provides its cursor/offsetDurable: Between 1 and 30 days retentionLatency: 50ms end-to-end durableCost: Competitive pricing, PaaS service so pay-as-you-go

52

Page 53: Service Assisted Device Communications on Microsoft Azure

Service Bus Messaging + Event Hubs!

Device Gateway Accelerator – Reference Architecture (Reykjavík)

1. Custom Protocol Gateway

2. Telemetry Pump and Adapters

3. Command Gateway

4. Provisioning Service and Metadata Store

Custom Protocol Gateway Host

MQTT CoAP …

Telemetry/Request Router

Notification/CommandRouter

Adapters Command API Host

Provisioning Service

Device Metadata and Key

Store

HD

Insi

gh

t

Biz

Talk

Orl

ean

s

Azu

re S

tora

ge

Azu

re D

bs

Serv

ice B

us HTTP

HTTP

Devices

AMQP

1

2 3

4

Configuration

HTTP

Yo

ur

Pro

cess

Page 54: Service Assisted Device Communications on Microsoft Azure

About Me

• VP, Distinguished Engineer leading the Development Platform Group at Neudesic

• Working on IoT, Intelligent Transportation and Hospitality & Gaming

• 8-time Microsoft MVP, Microsoft Azure

• Co-Author, “Windows Server AppFabric Cookbook” by Packt Pub.

• Chairman, Co-Founder Phoenix Connected Systems User Group (PCSUG.org)

• twitter: @rickggaribay

• blog: http://rickgaribay.net

• email: [email protected] | [email protected]

Page 55: Service Assisted Device Communications on Microsoft Azure