azure functions real world examples
TRANSCRIPT
![Page 1: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/1.jpg)
Azure Functions Real World Examples
Yochay Kiriaty
Oct 2nd 2016
![Page 2: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/2.jpg)
Yochay KiriatyPrincipal Program Manager @ MicrosoftAzure / App Service Tech Evangelist Various Start Ups
https://blogs.msdn.microsoft.com/appserviceteam@[email protected]
![Page 3: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/3.jpg)
Agenda• Why Serverless?• What is serverless? • Intro Azure Functions• Serverless patterns / Real-world examples
![Page 4: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/4.jpg)
Before cloud
On-PremiseCo-Lo
![Page 5: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/5.jpg)
Before cloud
How many servers do I need?
Which OS should I use?
How often should I patch my servers?
What size of servers
should I buy?
How often should I backup
my server?
How can I increase server utilization?
How I deploy new code to my server?
Which packages should be on my server?
It takes how long to provision a new server?
Are my server in a
secure location?
What happens if
the
power goes out?Do I n
eed secondary
network connection?
What is th
e right si
ze of
servers for m
y business n
eeds?
Who has physical
access to my servers?
Do I need a UPS?
What media should I
use to keep backup?
What storage I need to use?
How I scale my app?
What happens in case of
server hardware failure?
How can I d
ynamically
configure my app?
Who monitors
my Servers?Who monitors
my App?
![Page 6: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/6.jpg)
Then came IaaS …
How many servers do I need?
Which OS should I use?
How often should I patch my servers?
What size of servers
should I buy?
How often should I backup
my server?
How can I increase server utilization?
How I deploy new code to my server?
Which packages should be on my server?
It takes how long to provision a new server?
Are my server in a
secure location?
What happens if
the
power goes out?Do I n
eed secondary
network connection?
What is th
e right si
ze of
servers for m
y business n
eeds?
Who has physical
access to my servers?
Do I need a UPS?
What media should I
use to keep backup?
What storage I need to use?
How I scale my app?
What happens in case of
server hardware failure?
How can I d
ynamically
configure my app?
Who monitors
my Servers?Who monitors
my App?
![Page 7: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/7.jpg)
Is it PaaS time?
How many servers do I need?
Which OS should I use?
How often should I patch my servers?
How often should I backup
my server?
How can I increase server utilization?
How I deploy new code to my server?
Which packages should be on my server?
What is th
e right si
ze of
servers for m
y business n
eeds?
How I scale my app?
How can I d
ynamically
configure my app?
Who monitors
my App?
![Page 8: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/8.jpg)
Is it PaaS time?
How many servers do I need?
Which OS should I use?
How often should I patch my servers?
How often should I backup
my server?
How can I increase server utilization?
How I deploy new code to my server?
Which packages should be on my server?
What is th
e right si
ze of
servers for m
y business n
eeds?
How I scale my app?
How can I d
ynamically
configure my app?
Who monitors
my App?
![Page 9: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/9.jpg)
Serverless . . .
How many servers do I need?
How can I increase server utilization?What is
the rig
ht size of
servers for m
y business n
eeds?
How I scale my app?
![Page 10: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/10.jpg)
Event-driven/ instant scale
Sub-second billing
Abstraction of
servers
What is Serverless?
![Page 11: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/11.jpg)
Focus on Business
LogicReduced Time To Market
Reduced DevOps
Benefits of Serverless?
![Page 12: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/12.jpg)
Application’s evolution
Ship.
Acct. Mang.
Hist.
Database
Client
Ship.
DB
Client
Hist.
DB
Mang.
DB
Acct.
DB
POST
GET
POST
UPDATE
Monolithic Microservices
![Page 13: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/13.jpg)
Application’s evolution
Ship.
Acct. Mang.
Hist.
Database
Client
Monolithic
Ship.
DB
Client
Hist.
DB
Mang.
DB
Acct.
DB
POST
GET
POST
UPDATE
Microservices
![Page 14: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/14.jpg)
Application’s evolution
Ship.
DB
Client
Hist.
DB
Mang.
DB
Acct.
DB
POST
GET
POST
UPDATE
Microservices
![Page 15: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/15.jpg)
Application’s evolution
Client Mang.
DB
Microservices
POST Users
Users/Id
Users/Id
Users/Id
CreatUser
GetUser
UpdateUser
DeleteUser
GET
UPDATE
DELETE
Serverless
![Page 16: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/16.jpg)
Microsoft Serverless
App ServiceCortana Management Suite
Media ServicesLogic AppFunctionsStorage
Traffic Manager
Visual StudioServices
OMS Management SuitMachine LearningCDNDocument DB
Search
Scheduler
Active Directory Key Vault App Insights Cognitive Services Embedded Power BI
Hockey AppStream AnalyticsNotification HubIoT Hub Service Bus
![Page 17: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/17.jpg)
Azure FunctionsProcess events with Serverless code.
Make composing Cloud Apps insanely easyDevelop Functions in C#, Node.js, F#, Python, PHP, Batch and more Easily schedule event-driven tasks across servicesExpose Functions as HTTP API endpointsScale Functions based on customer demandEasily integrate with Logic Apps
Code Events + dataAzure Functions
![Page 18: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/18.jpg)
Functions Hello WorldDemo
![Page 19: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/19.jpg)
Functions Programming ModelTrigger(data) Input Input
code
Output
Output
• Function as a single unit of work• Functions are executed per trigger • Functions have inputs and outputs
Input
![Page 20: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/20.jpg)
Triggers and
bindings
![Page 21: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/21.jpg)
Image Processing
Demo
![Page 22: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/22.jpg)
Dual abstraction
Business Logic
Serverless PaaS
Other Services
• Serverless compute abstracts away the compute• Azure Functions Bindings abstract away the services you interact with
![Page 23: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/23.jpg)
Building Applications With FunctionsInstead of …• implementing a route inside of a Web Application server, I
write a function.• pulling – triggers • ‘SDK’ – bindings• writing large functional tests against a server, your
functional tests look more like unit tests per function.• building and deploying servers, deploy collections of
Functions
![Page 24: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/24.jpg)
Functions Programming Model - Best Practices• Functions should “do one thing”• Functions should be stateless• Functions should be idempotent• Functions should finish as quickly as possible
1
![Page 25: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/25.jpg)
Serverless Patterns
![Page 26: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/26.jpg)
Every 15 minutes Clean tableFind and clean invalid data
ApplicationsExample: Timer based processing
![Page 27: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/27.jpg)
FTP Download Function
Blob Replication
Blob Storage Cool Storage
Abnormal behavior
![Page 28: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/28.jpg)
Problem• Replicate logs from
one data center to another • Analyze the logs• Take action
Using Functions• Setup a VM/
Container/ WebJobs• Build/ patch/ deploy• Monitor• Manage FTP cred• Use FTP library• Use Azure SDK
Before Functions• Setup a VM/
Container/ WebJobs• Build/ patch/ deploy• Monitor• Manage FTP cred• Use FTP library• Use Azure SDK
![Page 29: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/29.jpg)
FTP Download Function
Blob Replication
Blob Storage Cool Storage
Abnormal behavior
![Page 30: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/30.jpg)
Blob Replication
Blob Storage Cool Storage
Abnormal behavior
FTP Download Manager Function
Single Folder Single Folder Single Folder
![Page 31: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/31.jpg)
File added toBlob Storage
Transform CSV to datarows Power BIChart graphic
ApplicationsExample: Azure service event processing
![Page 32: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/32.jpg)
Photo taken andWebHook called Stores in blob storage Produces scaled images
Async background processingExample: Serverless Mobile back ends
![Page 33: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/33.jpg)
API
Photo taken andWebHook called
![Page 34: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/34.jpg)
Problem• Expose REST API• Upload data to
storage• Process data
Using Functions• Setup a VM/
Container/ WebJobs• Build/ patch/ deploy• Monitor• Use Azure SDK• Async data
processing (scale)
Before Functions• Setup a VM/
Container/ WebJobs• Build/ patch/ deploy• Monitor• Use Azure SDK• Async data
processing (scale)
Photo taken andWebHook called
![Page 35: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/35.jpg)
Loaded web pagecallsWebHook
Completed pageCreate ad based on user profile
ApplicationsExample: Serverless Web Applications architectures
![Page 36: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/36.jpg)
Millionsof devices feedinto Stream Analytics
Store data inSQL Online
Transform to structured data
ApplicationsExample: Real-time stream processing
![Page 37: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/37.jpg)
![Page 38: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/38.jpg)
Problem• Collect tweets• Analyze tweets• Display rich analysis
Using Serverless• Setup a VM/ Container/
WebJobs• Build/ patch/ deploy• Monitor• Connect (auth)to twitter • Using Twitter API (SDK)• Analyze tweets• Build rich client to show
results
Before Serverless• Setup a VM/ Container/
WebJobs• Build/ patch/ deploy• Monitor• Connect (auth)to twitter • Using Twitter API (SDK)• Analyze tweets• Build rich client to show
results
![Page 39: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/39.jpg)
•Thick clients; thin & stateless backends• SPAs like Angular/React are your friend• Be sure to enable CORS
•Sync is nice, but Async is nicer• Async, queue based systems are more resilient• Read and internalize the reactive manifesto - http://www.reactivemanifesto.org/ • While synchronous work will happen, minimize the work done in a sync function and
kick off to a queue based async process (HTTP status code 202, not 201 )
•Live and die by the cloud• Like never before, develop on the cloud, test on the cloud, ship on the cloud• Not just FaaS, but use other serverless tech that best solves the problem (like Logic
Apps)
General practices for serverless
![Page 40: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/40.jpg)
Microsoft and ServerlessTry Functions – https://functions.azure.comTry App Service – https://tryappservice.azure.com
![Page 41: Azure Functions Real World Examples](https://reader035.vdocument.in/reader035/viewer/2022081416/586fb5b31a28abe57d8b766f/html5/thumbnails/41.jpg)