Download - Windows Azure and Embedded Devices

Transcript
Page 1: Windows Azure and Embedded Devices

Andy Cross

@andybareweb

Devices and Windows AzureThe openness of Windows Azure

Page 2: Windows Azure and Embedded Devices

Introduction

AgendaScenario OutlineDevices

TraditionalMobileEmbedded

Windows Azure ScalabilityCommandControl

WhoAndy Cross, Windows Azure MVP, co-founder UK Windows Azure User Group and HPC and Hadoop with Windows Azure expert.

Elastacloud Limited, HPC, Big Data and tiny little microchip consultancy

Time until next coffee

Page 3: Windows Azure and Embedded Devices

Devices are everywhere

Page 4: Windows Azure and Embedded Devices

2020 est

2012

Population, Earth

24bn33

%

9bnUnprecedented growth

The number of internet connected devices is sky rocketing.

The trend shows no sign of slowing.

Node.js server handles 2.4k/sec requests

0.000016% if the device connects hourlyOr 100000 servers to deal with 1%

Scenario outline IoT

Page 5: Windows Azure and Embedded Devices

Potential Workloads

PredictabilityDevices may report periodically (hourly temperature reading)Devices may interact frequently (retrieve news)

UnpredictabilityDevices may respond to user input (milk taken from fridge)Devices may be free to communicate (peer discovery)

Predictable Burst

Unpredictable Burst

Growing Fast“On and Off”

Com

pute

Time

Page 6: Windows Azure and Embedded Devices

4Devices and Azure ©Copyright 2012 09 / 14 /12

Only a scalable elastic computing infrastructure can solve this scalability challenge; such as Windows Azure

Time until next coffee

Page 7: Windows Azure and Embedded Devices

Device Classifications

Background processesPush notifications requiring Server contextsLocation sensitive data

Nike+Intelligent HousingRFID

Desktop PC and LaptopsBackground processesUser interactions

Desktop

Mobile

Embedded

Page 8: Windows Azure and Embedded Devices

Devices illustrated

Desktop Mobile Embedded

Capacity Cost Potential Capacity Cost Potential Capacity Cost Potential

Page 9: Windows Azure and Embedded Devices

Familiar form factorsDesktopVery resource rich

Fully featured clientsHTMLWPF

Azure Client LibrariesC#/VB .netRuby/Python/Node.js etc etc

Many communication methodsHTTP(S)WinsockUSB/Serial etc to devices

Mobile DevicesResource wealthy (increasing)

Very functional clientsHTMLSilverlightProprietary UI technologies

Azure Client LibrariesPlatform specific

Mainly web communication methodsHTTP(S)

Page 10: Windows Azure and Embedded Devices

Embedded … A real challenge with rewards!Limited Processor

Limited MemoryNo Operating SystemPartial or No Cryptography Libraries

Low level codeClose access to hardwareSmallest possible form factor

Many communication channels available from USB to Serial to network

Page 11: Windows Azure and Embedded Devices

How does Windows Azure Help Embedded?

Mobile ServicesMedia ServicesHPC and Big Data

Windows Azure StorageWindows Azure Service BusService Management API

Compute provisioned on demandStorage into 100s TBs easilyGeo-locatable

Scalable Resource

Infrastructure Services

Architectures

Page 12: Windows Azure and Embedded Devices

This is no Windows Azure Client for embedded devices. We will have to write our own.

Where could we find such a device?

This integration is only possible if the platform is truly open and device agnostic. There is no more evident test of this than consuming and interacting with Windows Azure from a device which does not have an operating system.

Page 13: Windows Azure and Embedded Devices

An introduction to NETMF.net Microframework

Time until next coffee

Page 14: Windows Azure and Embedded Devices

Background

What.net for Devices

• 64k of RAM• No need for MMU

WhyC# or VB.Net on a chip!Debugging tools such as Visual Studio allow for revolutionary development experience and real time debugging of devices

When->2007 Microsoft SPOT

2007 NETMF

2009 Open Sourced

2010 www.netmf.com

Page 15: Windows Azure and Embedded Devices

Comparative .net FrameworksR

eq

uir

ed

Devic

e R

eso

urc

e

Framework Complexity

.net Microframework

.net Compact Framework

.net Framework

Page 16: Windows Azure and Embedded Devices

Today’s devices• Netduino +

Inspired by ArduinoOpen source hardwarePin Compatible shieldsStandard enclosures and accessories

processor and memory

• Amtel 32-bit microcontroller

• Speed: 48MHz, ARM7• Code Storage: 64KB

without networking: 128 KB• RAM: 42KB

without networking: 60 KB

processor and memory

• STMicro 32-bit microcontroller• Speed: 168MHz, Cortex-M4• Code Storage: 384 KB• RAM: 100+ KB

2

Page 17: Windows Azure and Embedded Devices

Primer: netmf fundamentals120 seconds tour of netmf

Page 18: Windows Azure and Embedded Devices

Write in C# or Visual Basic (recent)Use Visual Studio (Express inc)Deploy and debug via USBDebugging WORKS! Breakpoints, immediates, watches etc

Development, Devices, Delivery

Open Source HardwareArduino layoutsCustom NETMF boardsDesign your ownDotnet Gadgeteer /Netduino GO

When complete, publish your software to a firmwareand distribute to your hardware vendor for delivery

Page 19: Windows Azure and Embedded Devices

.net Framework classes

NETMF architecture

Device specific implementations

User CodeYou

Who

Microsoft and community

Device vendors

What

Page 20: Windows Azure and Embedded Devices

Primer: GPIOGeneral Purpose IO (input/output)

Page 21: Windows Azure and Embedded Devices

Notice the class is standard C# with typical namespaces. There are additional using statements for device specific libraries.The class looks almost identical to a C# console app – but without args[] on the Main()

The AnalogInput class will do most of our work, it takes a hardware address.We Read() to get a voltage – and let whatever is on the pin do the work of generating this.

Page 22: Windows Azure and Embedded Devices

This class uses an OuputPort set to communicate with the on board LED of the Netduino.

We use the Write method to send a binary (Digital) signal to the output device, in this case the on board LED.

We use familiar System.Threading namespace to control the execution flow, in this case, pausing for 200ms so that the LED flashes changing state 5 times a second

Page 23: Windows Azure and Embedded Devices

Cryptography in the .net MicroFrameworkPrimer: Crypto

Page 24: Windows Azure and Embedded Devices

If you try to use System.Security.Cryptography you’ll most likely get …..

The Crypto assemblies in NETMF don’t ship for Netduino because of their size

Don’t despair! This is C#!http://www.microframework.nl/2009/09/05/shahmac-digest-class/

Page 25: Windows Azure and Embedded Devices

Using only standard System namespace types we can implement our own SHA-256 hash, sufficient for many Azure operations

Page 26: Windows Azure and Embedded Devices

Primer: net ioSockets and Networks in .net Microframework

Page 27: Windows Azure and Embedded Devices

This simple class makes a web request to retrieve the last tweet by @andybareweb using api.twitter.com

The connectivity is done using familiar .net classes, HttpWebRequest.

The response is retrieved and read from the response stream by a System.IO.StreamReader.

Using blocks manage object disposal.

Page 28: Windows Azure and Embedded Devices

If we modify the request to request a large number of tweets (100), we run into the limits of the devices’ capabilities (in terms of Main Memory).

In order to remedy this, we read smaller amount of the response stream, using a batch buffering approach.

Page 29: Windows Azure and Embedded Devices

Demo 1Storing sensor data in Windows Azure Storage

Time until next coffee

Page 30: Windows Azure and Embedded Devices

Temperature Device

Windows Azure Blob Storage

Trigger Button

Key technologies: Net.IO, Crypto, InterruptPort, File.IO

Key driver: turbocharge any device with limitless storage

Page 31: Windows Azure and Embedded Devices

On device storage from MB -> 2GB on SD card is increased infinitely.

Data stored in Windows Azure Table Storage, adding querying

Page 32: Windows Azure and Embedded Devices

Demo 2Commanding Devices using Windows Azure Distributed Queues

Time until next coffee

Page 33: Windows Azure and Embedded Devices

Key technologies: Net.IO, Crypto, OutputPorts

Key drivers: scalable command of remote and disconnected devices

OutputDevice

Windows Azure Queue Storage

Page 34: Windows Azure and Embedded Devices

Scalable queues used from Windows Azure Storage; more scenarios supported by Service Bus Topics where SSL is available.

Queue Mechanism

ZapChom

p Austin

Mojo

Page 35: Windows Azure and Embedded Devices

Demo 3Controlling Windows Azure from Devices

Time until next coffee

Page 36: Windows Azure and Embedded Devices

Key Technologies: Crypto, Net.IO and Analog Input

Key Driver: Materialize remote control over cloud with tangible artifact

Analog Input Device

Windows Azure Service Management

Gateway

Page 37: Windows Azure and Embedded Devices

To supplement the limitation of the device (no SSL) a custom Gateway is provided to handle this transport level.

This gateway then communicates with Service Mgt API

Page 38: Windows Azure and Embedded Devices

Big DataSolving data retrieval problems with HADOOP

Time until next coffee

Page 39: Windows Azure and Embedded Devices

A final thought

Gather 1KB of data 9bn global devices. This equates to 9 petabytes.

Imagine that per day or per hour.

HDInsight gives you the ability to gain sense from this scale of data.

Page 40: Windows Azure and Embedded Devices

© 2012 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Q&A

Thanks for Listening!