Wednesday, January 3, 2018

Realtime DataScience on IoT Edge Computing with Azure–HOL–Hands On Lab introduction

ScottGu is coming to Paris!! Hurry up to prepare a great 2.5 hours Hands On Lab, on realtime DataScience on Azure IoT Edge!

Register here for the Labs : 
Here for the entire event : 
Link to the HOL :  (made by Artem SHEIKO and Taras CHIEN ; with the contributors : Vincent Thavonekham + Igor Leontiev)

The detailed of the HOL will be available at the end on Github.

Below is a v1 introduction for the HOL (will be updated iteratively).

1 Introduction and why this Hands On Lab ?

IoT has been around approximately since 2000, and prior to that M2M (Machine to Machine), with sometimes some industrial standards such as OPC and later OPC UA, and sometimes no standards at all and only proprietary protocols.

Before we had :

  1. Simple Processing
    • [Machine A] <=> [Machine B]
    • [Machine A] <=> [Machine B] <=> [Machine C] <=> [Machine A] <=> etc…
  2. Complex Processing
    • [Machine A] <=> [Server/Cloud] <=> [Machine B]
      and [Machine C] <=> [Server/Cloud] <=> [Machine D]
      where the complex processing is handled by sending the telemetry the Server/Cloud, that will then analyze near-realtime + take decisions + send back actions via network

We notice that sending back and forth the data through the network is not efficient at all (ex. 3D X-Ray Scanners cannot send 2 TB of Data per second to the Cloud for processing).

But today, we are more interested to provide intelligence DIRECTLY into the sensors, on the so-called “Edge” side. Hence, “Edge Computing”




2 Architectural Overview: Let the Edge decide faster and avoid pyramidal decision structure


Sources :

3 What Azure IoT offer in terms of Edge Computing in one sentence ?

To ease the understanding, one could define a vision statement of the “Azure IoT Edge Computing” Solution such as :

“Design intelligence from PC (manually with Python 2.7.x or using Cognitive Services as a Black Box), deploy THE SAME into the Cloud, and again THE SAME architecture on the Device side !”

4 Overview of the Azure IoT Edge computing

BEFORE starting the Hands on Lab / Tutorials, because the entire process is quite complicated, we will explain, as an overview the end-to-end high level scenario.

Source : 

In the HOL, we will see that the extensibility allows us to replace the Module “Azure Stream Analytics on Edge device” by another on composed by your Module containing your own Python code, produced by your DataScientific.

4.1 On your PC (as a DataScientist)

  1. When DataScientists algorithm: Code you Python algorithm on your PC using Azure Machine Learning Workbench, then sends that to Azure, via a Docker Container
      • When using the ML model over and over, we will need to monitor and ensure that the model has not shifted beyond a given limit.
      • He can perform basically 2 things:
        • a Classification (probability to hit this mountain at this speed ?)
        • or a prediction (according to the heat, the number of hours used, etc… the 4rth fan will be out of usage in 3 days). And beyond a threshold of 24 hours, send a purchase order of an identical fan and as soon as I got back an internet connection.
  2. When AI / Cognitive Services : Pick and choose the Azure Cognitive Services you are interested in (then it is the same that is going to be deployed on the Edge Computing within the “IoT Lambda Architecture”)

4.2 On Azure Side

Use the Azure IoT Hub that your know, and locate the property Azure IoT Hub Edge.


Configure the reports (using Azure TimeSeries Insight)


4.3 On the Edge side

- Install and configure Module with Stream Analytics job for Edge Hub as a Source and Sink (see later explanation)

4.4 On “all sides”: The Fun part !

Now to glue all sides tightly we will start using concepts that can be made easy when compared to Geography for instance. For a second, imagine that you are the President of a country (or God if you prefer!) and you want to reshape entirely the towns/cities. You then have to take into account the following criteria:

1. Each city and town has its own specialty

2. The cities or Towns could be located around the Capital-area, or de-centralized on an island (i.e. far away with lots of time to travel from the capital to the de-centralized location)

3. The cities and towns are connected together through a mesh of roads, each of them has a sign-post telling where the road comes from and where it goes to

Now on Azure IoT Edge Computing, we have :

a. City or Town ó large or small modules with each of them having its specialty
(IoT Hub, near-realtime processing, Cold Storage,
Hot Storage, aggregation, Datascience computation, …)

b. Capital area vs. island ó the Azure IoT modules are located either in the Cloud

(Capital and Centralized decisions), or on the Edge
(de-centralized locations)

c. Mesh of roads with sign post ó Azure IoT Edge routes with a description of the
previous module and the next one

5 Conclusion in Azure IoT Edge

clip_image012Easy yes ?
Let’s summarize with a different comparison. Let consider a human with a central brain that centralize the decisions: Complex decisions and Simple decisions.

When our leg gets burnt, the hurting information do not need to flow back to the brain. By reflex, the leg automatically moves away from the fire.

Indeed, it would have taken too much time for the leg to send the information to the brain, wait for a decision, and sends the conclusion back to the leg. Rather, the leg relies on local decision for “simple” actions to be taken.

That’s the entire idea of Azure IoT Edge: Have centralized and managed decision in the Cloud, and we rely on local devices that could take decisions, and report it back to the Cloud to carry on further complex decisions.

6 Deeper explanation

Now that you understood, let’s go deeper into the concepts:

  • Each module is like a module is like Docker Container, hence we have the image and its “implementation” as “instance”, that is monitored be the Cloud Azure, thanks to a secured agent installed into the Edge
  • Now because the complexity is handled mostly by the Cloud, then pushed to the Edge, we have a kind of duplicated information, or call it a “twin” notion.
    • These Twins are separated into two types :
      • the Module Twins
      • and the Device Twins
    • Those Twins are necessary and automatically managed by the Cloud behind the scene to hide the complexity of having a Drone working disconnected from the Internet/Cloud and when the Internet is Back, information are synchronized back :
      • telemetry,
      • status (On, Off, …)
      • data (Edge contains a micro database)
      • commands (upgrade Firmware, etc…)
    • Now try coding that using the old fashion way with Assembler or C : How many months or years would that require ? and would that work and the code maintenable ??
      Next, I will carry on explaining why Azure IoT Edge is pseudo-complex, but the majority of the complexity is encapsulated behind Microsoft’s technology.

6.1 Why is it so complex ?

In the past, coding a real-time decision making on a Drone, we needed to know well the Intel Chipset and Assembly or C languages. It took a long time and was a tedious and error prone process. I can let you imagine that it was way more complex than the Azure IoT Edge solution. The later offers the following advantages :

- ease the entire ALM process, and perform DevOps with tools that every (good) one knows, such as VSTS-GIT (CB, CT, CD, …)

- secure on both Edge side and on Cloud side (authentication key, X509, SSO, …)

- allow “user friendly” yet powerful code such as Python to be developed an entire IoT+processing+ML system and deploy that (using Docker) all the way to the Edge, via the Cloud that supervises that all. Thus, Microsoft relies on opensource and cross platform technologies that could be ported to any other platform for reversibility needs.
Since we are using a regular Docker, we could extend the features by adding any additional ones.

6.2 What Next ?

  • Imagine all this working … with No Internet AT ALL, and with medical regulation constraints, … and even worst … this should work in France with endless crazy regulation  ?? Would that be a dream and totally unfeasible ??
  • Now imagine, extend all this to SAP and Dynamics365 and with an IoT System without coding anything at all ?? Not possible ??


  • Azure IoT offers an entire ecosystem, very rich, open and extensible, from Edge to SaaS, that was build with security and DevOps in mind.

  • Now it is important to pickup the proper options and design an IoT architecture that suites the needs : that’s the job of IoT & Cloud Enterprise Architects or Cloud Solution Architects.




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.