public v1 real world example of azure functions serverless conf london 2016

35
Azure Functions Real World Examples Serverless Conf - London 2016 Yochay Kiriaty Serverless Patterns and Best Practices

Upload: yochay-kiriaty

Post on 16-Apr-2017

420 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Public v1 real world example of azure functions serverless conf london 2016

Azure Functions Real World Examples

Serverless Conf - London 2016Yochay Kiriaty

Serverless Patterns and Best Practices

Page 2: Public v1 real world example of azure functions serverless conf london 2016

Yochay KiriatyPrincipal Program Manager @ MicrosoftAzure / App Service Tech Evangelist Various Start Ups

https://blogs.msdn.microsoft.com/appserviceteam@[email protected]

Page 3: Public v1 real world example of azure functions serverless conf london 2016

Agenda• Why Serverless?• Serverless patterns / Real-world examples

Page 4: Public v1 real world example of azure functions serverless conf london 2016

Event-driven/ instant scale

Sub-second billing

Abstraction of

servers

What is Serverless?

Page 5: Public v1 real world example of azure functions serverless conf london 2016

Focus on Business

LogicReduced Time To Market

Reduced DevOps

Benefits of Serverless?

Page 6: Public v1 real world example of azure functions serverless conf london 2016

CSV ?

So many options, where do I start?

Page 7: Public v1 real world example of azure functions serverless conf london 2016

Microsoft Serverless Services

Cortana Management Suite

Media ServicesStorage Traffic Manager

Visual StudioServices

OMS Management SuitMachine LearningCDNDocument DB

Search

SchedulerActive Directory Key Vault App Insights Cognitive Services Embedded Power BI

Hockey AppStream AnalyticsNotification HubIoT Hub Service Bus

Functions Logic App

Page 8: Public v1 real world example of azure functions serverless conf london 2016

Functions Programming ModelTrigger(data) Input Input

code

Output

OutputInput

Yochay to update to node.js example

Page 9: Public v1 real world example of azure functions serverless conf london 2016

Serverless Patterns

Page 10: Public v1 real world example of azure functions serverless conf london 2016

File added toBlob Storage

Transform CSV to datarows Power BIChart graphic

Scenario Azure service event processing

Page 11: Public v1 real world example of azure functions serverless conf london 2016

Tasks/ Activities Protect against

API DDOS Dynamically

configure CloudFlare (Block IP)

Source: https://www.troyhunt.com/azure-functions-in-practice/

Page 12: Public v1 real world example of azure functions serverless conf london 2016

Block IP

Q msgIP 2 block

Blob Replication

DDOS

Site

Source: https://www.troyhunt.com/azure-functions-in-practice/

Page 13: Public v1 real world example of azure functions serverless conf london 2016

Tasks/ Activities Protect against

API DDOS Dynamically

configure CloudFlare (Block IP)

Source: https://www.troyhunt.com/azure-functions-in-practice/

Before ServerlessSetup a VM/

Container/ WebJobsBuild/ patch/ deploy

(OS)Monitor infra (VM/

Container)Use Azure SDKManage CloudFlare

credsUse CLoudFlare API

Using ServerlessSetup a VM/

Container/ WebJobsBuild/ patch/ deploy

(OS)Monitor infra (VM/

Container)Use Azure SDKManage CloudFlare

credsUse CLoudFlare API

Page 14: Public v1 real world example of azure functions serverless conf london 2016

Functions Programming Model - Best Practices

• Functions should “do one thing”

1

Page 15: Public v1 real world example of azure functions serverless conf london 2016

Every 15 minutes Clean tableFind and clean invalid data

Scenario Timer based processing

Page 16: Public v1 real world example of azure functions serverless conf london 2016

Tasks/ Activities Replicate logs

from one data center to another

Analyze the logsTake action

based on data

Page 17: Public v1 real world example of azure functions serverless conf london 2016

FTP Download Function

Blob Replication

Blob Storage Cold Storage

Abnormal behavior

Stream analytics

Page 18: Public v1 real world example of azure functions serverless conf london 2016

Before ServerlessSetup a VM/

Container/ WebJobsBuild/ patch/ deploy

(OS)Monitor infra (VM/

Container)Manage FTP credsUse FTP libraryUse Azure SDK

Tasks/ Activities Replicate logs

from one data center to another

Analyze the logsTake action

based on data

Using ServerlessSetup a VM/ Container/

WebJobsBuild/ patch/ deploy

(OS)Monitor infra (VM/

Container)Manage FTP creds, but

with automation with dynamic settings

Use FTP libraryUse Azure SDK

Page 19: Public v1 real world example of azure functions serverless conf london 2016

FTP Download Function

Blob Replication

Blob Storage Cool Storage

Abnormal behavior

Page 20: Public v1 real world example of azure functions serverless conf london 2016

Blob Replication

Blob Storage Cold Storage

Abnormal behavior

FTP Download Manager Function

Single Folder Single Folder Single Folder

Page 21: Public v1 real world example of azure functions serverless conf london 2016

Functions Programming Model - Best Practices

• Functions should finish as quickly as possible

Page 22: Public v1 real world example of azure functions serverless conf london 2016

Millionsof devices feedinto Stream Analytics

Store data inSQL Online

Transform to structured data

Scenario Real-time stream processing

Page 23: Public v1 real world example of azure functions serverless conf london 2016

Tasks/ Activities Collect tweetsAnalyze tweetsDisplay rich

analysis

Page 24: Public v1 real world example of azure functions serverless conf london 2016

Collect Tweets

Logic App

Analyze Tweets

Store Data

Store Data

Page 25: Public v1 real world example of azure functions serverless conf london 2016

Tasks/ Activities Collect tweetsAnalyze tweetsDisplay rich

analysis

Before ServerlessSetup a VM/ Container/

WebJobsBuild/ patch/ deploy

(OS)Monitor infraConnect (auth)to

twitter Using Twitter API (SDK)Analyze tweetsBuild rich client to

show results

Using ServerlessSetup a VM/ Container/

WebJobsBuild/ patch/ deploy

(OS)Monitor infraConnect (auth)to

twitter Using Twitter API (SDK)Analyze tweetsBuild rich client to

show results

Page 26: Public v1 real world example of azure functions serverless conf london 2016

Functions Programming Model - Best Practices

• Functions should be stateless• Functions should be idempotent

Page 27: Public v1 real world example of azure functions serverless conf london 2016

Using digital insights to optimize transactions in the real world

Plexure

Page 28: Public v1 real world example of azure functions serverless conf london 2016
Page 29: Public v1 real world example of azure functions serverless conf london 2016

EVENT SWARM ENGAGEMENT CHANNELS

FLEXIBLE BIG DATA PIPELINE

INTELLIGENCE PIPELINE

3RD PARTY

EVENT INGESTION ENGINE

SQL DATA WAREHOUSE

DATA LAKE STORAGE & ANALYTICS

STREAMANALYTICS

WEBCUSTOM

SERVICES

WEARABLES

POS

DIGITAL DISPLAYS

BOTS

KIOSKS

MOBILE APP

SENSORS

OMNI CHANNEL ENGAGEMENT

WORKFLOW ORCHESTRATION

ENTERPRISE INTEGRATION

CUSTOM INTELLIGENCE

INTELLIGENTSERVICES

CUSTOMFUNCTIONS

MACHINELEARNING

COGNITIVESERVICES

EXISTING

NEW

API GATEWAY

API GATEWAY

Page 30: Public v1 real world example of azure functions serverless conf london 2016

Event-driven/ instant scale

Sub-second billing

Abstraction of

servers

What is Serverless?

Page 31: Public v1 real world example of azure functions serverless conf london 2016

Functions Programming Model - Best Practices

• Functions should “do one thing”• Functions should finish as quickly as possible• Functions should be stateless• Functions should be idempotent

1

Page 32: Public v1 real world example of azure functions serverless conf london 2016

Building Serverless Apps With Azure FunctionsInstead of …• pulling –> triggers • ‘SDK’ –> bindings• routes in a Web App (server) –> single function• writing large functional tests against a server –> functional

tests look more like unit tests per function.• building and deploying servers –> deploy collections of

Functions

Page 33: Public v1 real world example of azure functions serverless conf london 2016

• Thick clients & stateless backends• Statless Scale• SPA (Angular /React) are your friend (enable CORS )

• Sync works, but Async rocks! • Async Scale• Async, queue based systems are more resilient• Read and internalize the reactive manifesto - http://www.reactivemanifesto.org/

• Live and die by the cloud• Develop on the cloud, test on the cloud, ship on the cloud• Lots of different services • Not just FaaS, but use other serverless tech that best solves the problem (like

Logic Apps)

Serverless Architecture- Best Practices

Page 34: Public v1 real world example of azure functions serverless conf london 2016

Microsoft and ServerlessTry Functions – https://functions.azure.comTry App Service – https://tryappservice.azure.com

Page 35: Public v1 real world example of azure functions serverless conf london 2016