2. Agenda
#GlobalAzure
• Azure Functions
• About Azure Functions
• How do Durable Functions Differ
• Durable function patterns
• Leverage the power at scale
• Kick Start your Development
• Economics of Serverless Computing
• Price Models
• Breakeven, TCO Fixed to Variable Costs
• Use Cases : Serverless B2B EDI Integrations
• Demo
• Chain Functions
• Order Fulfillment
3. Azure Functions
• Runs Small pieces of code
• No need for a dedicated infrastructure for it
• You get 100000 executions for free
• Features
• Choice of language - Write functions using your choice of C#, F#, or Node.
• Pay-per-use pricing model - Pay only for the time spent running your code.
• Bring your own dependencies - Functions supports NuGet and NPM, so you can use your favorite
libraries.
• Integrated security - Protect HTTP-triggered functions with OAuth providers such as Azure Active
Directory, Facebook, Google, Twitter, and Microsoft Account.
• Simplified integration - Easily leverage Azure services and software-as-a-service (SaaS) offerings.
• Flexible development - Code your functions right in the portal or set up continuous integration
and deploy your code through GitHub, Visual Studio Team Services, and other supported
development tools.
• Open-source - The Functions runtime is open-source and available on GitHub.
#GlobalAzure
4. Timer-based
processing
Azure service
event processing
Serverless web
application architectures
Real-time stream
processing
Functions supports an event based on a timer using Cron job syntax. For
example, execute code that runs every 15 minutes and clean up a
database table based on custom business logic
Functions supports triggering an event based on an activity in an Azure
service. For example, execute serverless code that reads newly discovered
test log files in a Blob storage container, and transform this into a row in a
SQL Database table.
Internet of Things devices send messages to Stream Analytics, which then
calls a function to transform the message. This function processes the
data and creates a new record in a SQL database.
Functions can power a single-page app. The app calls functions using the
WebHook URL, saves user data and decides what data to display. Or, do
simple customisations, such as changing ad targeting by calling a function
and passing it user profile information.
What Functions can Do
8. • An Extension to Durable Task
Framework
• Allows you : Event sourcing,
checkpointing, and replay
• Features
• They define workflows in code. No JSON
schemas or designers are needed.
• They can call other functions
synchronously and asynchronously.
Output from called functions can be
saved to local variables.
• They automatically checkpoint their
progress whenever the function awaits.
Local state is never lost if the process
recycles or the VM reboots.
8
Event Sourcing Pattern
Durable Functions
9. Chain Fan Out-Fan In
Monitors Actionable WF
Function chaining refers to the pattern of executing a sequence of
functions in a particular order. Often the output of one function needs to
be applied to the input of another function
Fan-out/fan-in refers to the pattern of executing multiple functions in
parallel, and then waiting for all to finish. Often some aggregation work is
done on results returned from the functions.
Automated processes allowing timeouts and compensation logic.The monitor pattern refers to a flexible recurring process in a workflow
Patterns
10. 10
• Understand Azure Functions
• Overview of Durable Task Framework
• Async-Await pattern
• Multi-Threading concepts
• Event Driven programming
• Azure Functions template if you want to use Visual Studios.
• NuGet this to your solution
• Microsoft.Azure.WebJobs.Extensions.DurableTask
• Microsoft.Azure.WebJobs
• You are good to go.
Kickstart Durable Functions
11. #PuneDevCon 11
• Indeterministic Code Execution
• Non-Blocking Tasks
• Never initiate Async tasks to external sources
• Ex: HttpClient.SendAsync()=> //Fetch Something from Website X for me.
• No To infinity loops, unless you want to pay for it
Things that you should not do !
12. • Duration of Code Execution {Aggregate Time}
• Consumed Resources {Memory}
• No of times the function is Executed {Count}
• Miscellaneous costs {Supported services}
12
Price Components
Component Units
Free Requests 1,000,000
Free Ram 400,000
Per GB-Second $0.0000160
Per Request $0.0000002
Free CPU NA
Per GHZ-Second NA
Azure Functions Pricing
• N is number of executions in month
• NF is number of free requests per month
• PG is price per GB-second
• PC is price per GHz-second
• PR is price per request
• PT is TOTAL monthly price
• TE is time per execution in seconds
• MM is memory allocation in MB
• CC is CPU allocation in MHz
• QF is free GB-seconds
• PF is free Ghz-seconds
P = [(N*TE)*(M/1024)-QF]*PG +
[(N*T)(C/100)-PF]*PC +
(N-NF)* PR
Universal Serverless Pricing Equation
13. #GlobalAzure
0
100
200
300
400
500
600
700
1 2 3 4 5 6 7 8 9 10 11 12
USD
Execution in Millions (3 Sec.)
• Start your costs at $0
• Pay Only for what you use.
• Rises per unit execution
• Scale for Performance
• No Need to keep extra resources
for performance issues
• Reduced Cost of ownership
Move from Stepped FC to Exponential VC
14. #GlobalAzure
0 10000 20000 30000 40000 50000 60000
Serverless
IaaS
IaaS vs Serverless
Total AppS Functions B2B DB
• Serverless : USD ~23400
• IaaS : USD ~56000
• 41.80 % Cost Reduction
• No Performance Issues, Scales at
runtime
• Reduced Fixed Costs
• Predictable Cost per unit
• Reduced Labor rate by 70% (
Maintenance costs towards Infra
Assets)
Cost Savings on a entire serverless solution