Architectures lambda - Techdays camps 2015

Preview:

Citation preview

AMBIENT INTELLIGENCE

#mstechdays techdays.microsoft.fr

techdays•2015camps

Architectures LambdaMichel Hubert / Georges Damien@michelhubert @georges_damien

tech.days 2015#mstechdaysArchitecture Lambda

About me

• Michel HubertDirecteur Technique chez CellenzaMVP AzureMicrosoft P-Seller

tech.days 2015#mstechdaysArchitecture Lambda

About me

• Georges DamienConsultant chez Cellenza

tech.days 2015#mstechdaysArchitecture Lambda

Agenda Architectures Lambda Définition Le Temps réel Event Hub Stream Analytics Le Batch Data Factory HD Insight Machine Learning

tech.days 2015#mstechdaysArchitecture Lambda

Introduction

« La meilleure façon de prédire le futur est de regarder le passé et le

présent ! »

Pourquoi les architectures lambda ?

tech.days 2015#mstechdaysArchitecture Lambda

IntroductionHistoriquement, le BigData est une suite logique de la B.I.Donc on a appliqué les techniques de la B.I. : Le BatchCe n’est pas plus suffisant !

Des flux de données à prendre en compte en temps-réel

Des historiques très volumineux qui recèlent de la valeur

Pourquoi les architectures lambda ?

tech.days 2015#mstechdaysArchitecture Lambda

De quoi parle-t-on ?Architecture lambda ?

tech.days 2015#mstechdaysArchitecture Lambda

Principe de baseLa base de données classique :Ex d’une action utilisateur (changement d’adresse) :

Chaque update écrase des données précédentes !

Architecture basée sur des données immuables

UPDATE

tech.days 2015#mstechdaysArchitecture Lambda

Principe de baseStockage immuable :La mort de l’update, vive l’insert !

Toute autre information peut être dérivée/reconstruite à partir de ces données brutes

Architecture basée sur des données immuables

tech.days 2015#mstechdaysArchitecture Lambda

Big Data + Temps réelQuels cas d’usage ?

tech.days 2015#mstechdaysArchitecture Lambda

Réponse MicrosoftPresentation and action

Storage andBatch Analysis

StreamAnalysis

IngestionCollectionEvent production

Event hubs

Cloud gateways(web APIs)

Field gateways

Applications

Legacy IOT (custom protocols)

Devices

IP-capable devices(Windows/Linux)Low-power devices (RTOS)

Search and query

Data analytics(Power BI)

Web/thick client dashboardsEvent Hubs

SQL DB

HD Insight

Power BI

Storage Blobs

Stream Analytics

Devices to take action

MachineLearning

more to come…

tech.days 2015#mstechdaysArchitecture Lambda

ScénarioPrenons un scénario Exemple :Site eCommerce / Retail

Quels gains ?• Analyse temps réel des comportements,• Calcul du Taux d’abandon de panier,• Prévision de stock• Détection de Fraude• Analyse d’une campagne marketing• Quels produits ne déclenchent pas d’achat ? Problème de stock ? De

prix ?

Architecture Lambda

tech.days 2015#mstechdaysArchitecture Lambda

Event Hub

La Master Data

tech.days 2015#mstechdaysArchitecture Lambda

Azure Service BusAzure Service

BusRelay

Queue

Topic

Notification Hub

Event Hub

NAT and Firewall Traversal ServiceRequest/Response ServicesUnbuffered with TCP ThrottlingMany publishers and many consumers to communicate over a FIFO like channel. (Competing consumers and Queue-based Load leveling scenarios)

Pub / Sub communication channel. Each Consumer subscribes to a copy of message

High-scale notification distributionMost mobile push notification servicesMillions of notification targets

tech.days 2015#mstechdaysArchitecture Lambda

EventHub Event Hub vs Topics / QueuesBus de messages

Topics / Queues Event Hub

tech.days 2015#mstechdaysArchitecture Lambda

Event HubPrincipe général

Event Producers

Azure Event Hub

> 1M Producers> 1GB/sec Aggregate Throughput

Up to 32 partitions via portal, more on

request

Parti

tions

Direct

PartitionKeyHash

Consumer

Group(s)

Receivers

AMQP 1.0Credit-based flow controlClient-side cursorsOffset by Id or Timestamp

tech.days 2015#mstechdaysArchitecture Lambda

Event HubEnvoi des donnéesChaque Event Hub a un nombre déterminé de partitionsChaque événement possède une clef de partition, assignée à une partition en sortie

Partition 1

Partition 2

Partition “n”

Event 1PartitionKey=

A

Event 1PartitionKey=

B

tech.days 2015#mstechdaysArchitecture Lambda

Publication de message .Net / AMQP

tech.days 2015#mstechdaysArchitecture Lambda

Publication de message via HTTP<protocol>://<namespace>.servicebus.windows.net/<eventhubname>/publisher/<partitionkey>/messages

tech.days 2015#mstechdaysArchitecture Lambda

Event HubConsommation des données

Partition 1

Partition 2

Partition “n”

Event 1Pkey = A

Event 2Pkey = B Receiver 6

Receiver 2

Worker “n”

Receiver 1Receiver “n”

Worker 1

Chaque consommateur (worker) se connecte à l’Event Hub, et reçoit les messagesOn met en place un receiver pour chacune des partitions attendues

tech.days 2015#mstechdaysArchitecture Lambda

Event HubConsommation multiple

On met en place des groupes de consommateurs lorsque plusieurs applications consomment un même flux

Partition 1

Partition 2

Partition “n”

Consumer Group C

Callback for prtn. 6

Callback for prtn. 2

Worker “n”

Callback for prtn. 1

Callback “n”

Worker 1Consumer Group B

Callback for prtn. 6

Callback for prtn. 2

Worker “n”

Callback for prtn. 1

Callback “n”

Worker 1Consumer Group A

Worker “n”Callback for prtn. 6

Callback for prtn. 2

Callback for prtn. 1

Callback “n”

Worker 1

tech.days 2015#mstechdaysArchitecture Lambda

IEventProcessorIEventProcessor

tech.days 2015#mstechdaysArchitecture Lambda

IEventProcessor

Architecture Lambda

Démo : Event Hub

tech.days 2015#mstechdaysArchitecture Lambda

Stream Analytics

Données en mouvement« Complex Event Processing »

tech.days 2015#mstechdaysArchitecture Lambda

Données au reposStream Analytics

SELECT count(*) FROM ParkingLotWHERE type = 'Auto' AND color = 'Red'

Question“Combien de voitures rouges dans le parking?”

Répondre avec une base de donnée relationnelleMarcher jusqu’au parkingCompter les véhicules qui sont: Rouge, Voiture

tech.days 2015#mstechdaysArchitecture Lambda

Données en mouvementStream AnalyticsLa question est différente“Combien de voitures rouges sont passées au marqueur 18A sur l’A-10 dans la dernière heure?”

Répondre avec une base de donnée relationnelleS’arrêter, faire se garer toutes les voitures qui arrivent pendant l’heure dans un parking, les compter

Pas la meilleure des solutions…

tech.days 2015#mstechdaysArchitecture Lambda

L’avantage définitif

SELECT count(*) FROM A-10WHERE Type = ‘Voiture’ and Color = ‘Rouge’GROUP BY TumblingWindow(hour, 1)

La question est différente“Combien de voitures rouges sont passées au marqueur 18A sur l’A-10 dans la dernière heure?”

tech.days 2015#mstechdaysArchitecture Lambda

Agrégation temporelle – SQL LikeTumblingWindow(minute,5) HoppingWindow(minute, 10 , 5)

SlidingWindow(minute, 3)

tech.days 2015#mstechdays

Stream Analytics

tech.days 2015#mstechdaysArchitecture Lambda

Stream Analytics

Architecture Lambda

Démo : Stream Analytics

tech.days 2015#mstechdaysArchitecture Lambda

Data Factory

Une usine à données

M I C R O S O F T C O N F I D E N T I A L – I N T E R N A L O N LY

Azure Blob Storage Azure DB

Raw Materials Acquire Raw Materials

Transform raw materials into “finished goods” Deliver

Data Sources Ingest Transform & Analyze Publish

M I C R O S O F T C O N F I D E N T I A L – I N T E R N A L O N LY

Last Name First Name Country Age …Flasko Mike Canada 32

Anand Subbaraj USA 30

Gaurav Malhotra USA 72

… …. …. ….

Last Name First Name At risk of churning ….

Flasko Mike Yes

Anand Subbaraj No

Gaurav Malhotra Yes

… ….

Raw Materials “Finished Good”

Predict customer churn

M I C R O S O F T C O N F I D E N T I A L – I N T E R N A L O N LY

Azure Blob Storage

Call Log Files

Customer Table

On Premises Data Mart

Call Log Files

Customer Table

Azure DB

Customer Churn Table

Visualize

Data Set(Collection of files, DB table, etc)

Activity: a processing step (Hadoop job, custom code, ML model, etc)

Pipeline: a logical group of activities

Data Factory Concepts

…Data Sources Ingest Transform & Analyze Publish

Customer Call Details

Customers Likely to Churn

Transform, Combine, etc

Analyze Move

tech.days 2015#mstechdaysArchitecture Lambda

Azure Data Factory

A managed cloud service for building & operating data pipelines (aka. data flows)

1. Orchestrate, monitor & schedule • compose data processing, storage & movement services (on premises

& cloud)2. Automatic infrastructure mgmt

• combine pipeline intent w/ resource allocation & mgmt• data movement as a service (global footprint & on premises)

3. Single pane of glass • one place to manage your network of data flows

tech.days 2015#mstechdaysArchitecture Lambda

Azure DataFactoryEtaes de mise en oeuvre

tech.days 2015#mstechdaysArchitecture Lambda

Syntax – Example

Data Set 1

Azure Blob(e.g. log files)

Data Set 2

Azure Blob(e.g. aggregated

logs)

Activity 1

HDInsight(Hive query)

Data Set 3

Azure SQL(e.g. data mart)

Activity 2

Copy(provided by

ADF)

Pipeline (Active Period: July 2015 to July 2016)

Process log files with Hadoop & put the results into my SQL DB

tech.days 2015#mstechdaysArchitecture Lambda

Azure DataFactoryInterfaces

tech.days 2015#mstechdaysArchitecture Lambda

Azure DataFactoryLes langages

tech.days 2015#mstechdaysArchitecture Lambda

Azure DataFactoryPowerShell - Déploiement

tech.days 2015#mstechdaysArchitecture Lambda

Data Factory

Architecture Lambda

Démo : HDInsight

tech.days 2015#mstechdaysArchitecture Lambda

Machine Learning

Pour aller plus loin…

tech.days 2015#mstechdaysArchitecture Lambda

Machine Learning

tech.days 2015#mstechdaysArchitecture Lambda

Apprentissage supervisé

tech.days 2015#mstechdaysArchitecture Lambda

Les principales classes

tech.days 2015#mstechdaysArchitecture Lambda

Classification

tech.days 2015#mstechdaysArchitecture Lambda

Ranking

tech.days 2015#mstechdaysArchitecture Lambda

Recommandations ProduitMachine Learning

tech.days 2015#mstechdaysArchitecture Lambda

Des données aux résultatsMachine Learning

tech.days 2015#mstechdaysArchitecture Lambda

API

Architecture Lambda

Démo : Machine Learning

tech.days 2015#mstechdaysArchitecture Lambda

Des questions ?

• Michel Hubertmichel.hubert@cellenza.com@michelhubert• Georges Damien• Georges.damien@Cellen

za.com• @georges_damien

© 2015 Microsoft Corporation. All rights reserved.

#mstechdays techdays.microsoft.fr/camp

techdays•2015camps

Architecture Lambda