Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Azure Functions Real World Examples
1.
2. Yochay Kiriaty
Principal Program Manager @ Microsoft
Azure / App Service
Tech Evangelist
Various Start Ups
https://blogs.msdn.microsoft.com/appserviceteam
@yochayk
yochay@microsoft.com
3. Agenda
• Why Serverless?
• What is serverless?
• Intro Azure Functions
• Serverless patterns / Real-world examples
5. Before cloud
How often should
I patch my servers?
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?
6. Then came IaaS …
How often should
I patch my servers?
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?
7. Is it PaaS time?
How often should
I patch my servers?
How can I increase server utilization?
How I deploy new code to my server?
Which packages should
be on my server?
8. Is it PaaS time?
How often should
I patch my servers?
How can I increase server utilization?
How I deploy new code to my server?
Which packages should
be on my server?
16. Microsoft Serverless
App ServiceCortana
Management Suite
Media ServicesLogic AppFunctionsStorage
Traffic
Manager
Visual Studio
Services
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
17. Azure Functions
Process events with Serverless code.
Make composing Cloud Apps insanely easy
Develop Functions in C#, Node.js, F#, Python, PHP, Batch and more
Easily schedule event-driven tasks across services
Expose Functions as HTTP API endpoints
Scale Functions based on customer demand
Easily integrate with Logic Apps
22. Dual abstraction
• Serverless compute abstracts away the compute
• Azure Functions Bindings abstract away the
services you interact with
23. Building Applications With Functions
Instead 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
24. 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
28. 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
34. 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 and
WebHook called
36. Millions of devices feed
into Stream Analytics
Store data in
SQL Online
Transform to structured data
37.
38. 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
39. • SPAs like Angular/React are your friend
• Be sure to enable CORS
• 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 )
• 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
40. Microsoft and Serverless
Try Functions – https://functions.azure.com
Try App Service – https://tryappservice.azure.com