public v1 real world example of azure functions serverless conf london 2016
TRANSCRIPT
Azure Functions Real World Examples
Serverless Conf - London 2016Yochay Kiriaty
Serverless Patterns and Best Practices
Yochay KiriatyPrincipal Program Manager @ MicrosoftAzure / App Service Tech Evangelist Various Start Ups
https://blogs.msdn.microsoft.com/appserviceteam@[email protected]
Agenda• Why Serverless?• Serverless patterns / Real-world examples
Event-driven/ instant scale
Sub-second billing
Abstraction of
servers
What is Serverless?
Focus on Business
LogicReduced Time To Market
Reduced DevOps
Benefits of Serverless?
CSV ?
So many options, where do I start?
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
Functions Programming ModelTrigger(data) Input Input
code
Output
OutputInput
Yochay to update to node.js example
Serverless Patterns
File added toBlob Storage
Transform CSV to datarows Power BIChart graphic
Scenario Azure service event processing
Tasks/ Activities Protect against
API DDOS Dynamically
configure CloudFlare (Block IP)
Source: https://www.troyhunt.com/azure-functions-in-practice/
Block IP
Q msgIP 2 block
Blob Replication
DDOS
Site
Source: https://www.troyhunt.com/azure-functions-in-practice/
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
Functions Programming Model - Best Practices
• Functions should “do one thing”
1
Every 15 minutes Clean tableFind and clean invalid data
Scenario Timer based processing
Tasks/ Activities Replicate logs
from one data center to another
Analyze the logsTake action
based on data
FTP Download Function
Blob Replication
Blob Storage Cold Storage
Abnormal behavior
Stream analytics
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
FTP Download Function
Blob Replication
Blob Storage Cool Storage
Abnormal behavior
Blob Replication
Blob Storage Cold Storage
Abnormal behavior
FTP Download Manager Function
Single Folder Single Folder Single Folder
Functions Programming Model - Best Practices
• Functions should finish as quickly as possible
Millionsof devices feedinto Stream Analytics
Store data inSQL Online
Transform to structured data
Scenario Real-time stream processing
Tasks/ Activities Collect tweetsAnalyze tweetsDisplay rich
analysis
Collect Tweets
Logic App
Analyze Tweets
Store Data
Store Data
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
Functions Programming Model - Best Practices
• Functions should be stateless• Functions should be idempotent
Using digital insights to optimize transactions in the real world
Plexure
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
Event-driven/ instant scale
Sub-second billing
Abstraction of
servers
What is Serverless?
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
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
• 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
Microsoft and ServerlessTry Functions – https://functions.azure.comTry App Service – https://tryappservice.azure.com