Architect your cloud application to
save cost up to 90% using azure
functions
Karthikeyan VK
Web Architect
Twitter: @Karthik3030
Blogs.karthikeyanvk.in
Why Azure functions ?
No server needed
dedicated for a
single application
You don’t own a
server
Scale on demand
Pay per use
pricing model
Supports various
languages.
What is Azure functions ?
 Azure Functions is a solution for easily running
small pieces of code, or "functions," in the cloud.
Types of Azure functions
Timer Trigger
Http Trigger
Queue/Blob Trigger
Web Hooks
Functions Plan
 Consumption plan - When your function runs, Azure provides all of the necessary
computational resources. You don't have to worry about resource management, and you only
pay for the time that your code runs.
 App Service plan - Run your functions just like your web, mobile, and API apps. When you
are already using App Service for your other applications, you can run your functions on the
same plan at no additional cost.
Web App
Pay before use
Always on, so no initial time lag
Minimum cost 35 dollars*
Extra cost for auto scaling
Azure functions
Pay per use
Slow Start-up
1 million requests and 400,000 GB-s
of resource consumption per month
Scale on demand
Azure Functions – Stateless
Demo
How cost Is
saved ?
Manage States in Azure functions
What is state ?
 The state is all of the information that is retained by your
program, often with respect to previous events or
interactions.
 For example, If you add a product to the cart in Amazon using
mobile app and when you login into amazon web app, you can
see the product added in your web app. Now the cart details
is the one of the state of amazon application
Azure Durable functions
Why Durable Functions ?
 Azure functions are stateless, to manage
states in azure functions. You need Durable
functions
 Long running functions can be architected to
run on Durable functions
Why Durable Functions ?
 You can define workflows in code.
 They can call other functions synchronously and
asynchronously. Output from called functions can
be saved to local variables
Demo on
Azure
Durable
functions
Patterns in Azure durable functions
Function Chaining
Fan in/Fan out
Async Http API
Monitoring
Human Interaction
Pattern #1: Function chaining
 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.
Pattern #2: Fan-out/fan-in
 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.
Pattern #3: Async HTTP APIs
 A common way to implement this pattern is by having the long-running action
triggered by an HTTP call, and then redirecting the client to a status endpoint
that they can poll to learn when the operation completes.
Pattern #4: Monitoring
 The monitor pattern refers to a flexible recurring process in a workflow
 Instead of exposing an endpoint for an external client to monitor a long-
running operation, the long-running monitor consumes an external endpoint,
waiting for some state change.
Pattern #5: Human interaction
 Involving humans in an automated process is tricky because people aren't as
highly available and as responsive as cloud services.
Demo on Azure
Durable functions
- Patterns
How cost Is
saved ?
Draw backs of Standard Azure functions
 In consumption mode, the azure functions has
cold start
 You cannot define the CPU type of your
running process
Premium Azure functions
 No cold start
 VNet connectivity
 Premium hardware
 Elastic SKU
Demo on Premium
Azure functions
How cost Is
saved ?
Azure Proxies
Why Azure proxies ?
 Single URL for multiple apps
 Build fake back end in minutes
 Avoid CORS issues
Demo on Azure
Proxies
How cost Is
saved ?
References
• https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-
overview
• https://docs.microsoft.com/en-us/azure/azure-functions/durable-functions-install

Save Azure Cost

  • 1.
    Architect your cloudapplication to save cost up to 90% using azure functions Karthikeyan VK Web Architect Twitter: @Karthik3030 Blogs.karthikeyanvk.in
  • 2.
    Why Azure functions? No server needed dedicated for a single application You don’t own a server Scale on demand Pay per use pricing model Supports various languages.
  • 3.
    What is Azurefunctions ?  Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud.
  • 4.
    Types of Azurefunctions Timer Trigger Http Trigger Queue/Blob Trigger Web Hooks
  • 5.
    Functions Plan  Consumptionplan - When your function runs, Azure provides all of the necessary computational resources. You don't have to worry about resource management, and you only pay for the time that your code runs.  App Service plan - Run your functions just like your web, mobile, and API apps. When you are already using App Service for your other applications, you can run your functions on the same plan at no additional cost.
  • 6.
    Web App Pay beforeuse Always on, so no initial time lag Minimum cost 35 dollars* Extra cost for auto scaling Azure functions Pay per use Slow Start-up 1 million requests and 400,000 GB-s of resource consumption per month Scale on demand
  • 7.
  • 8.
  • 9.
  • 10.
    Manage States inAzure functions
  • 11.
    What is state?  The state is all of the information that is retained by your program, often with respect to previous events or interactions.  For example, If you add a product to the cart in Amazon using mobile app and when you login into amazon web app, you can see the product added in your web app. Now the cart details is the one of the state of amazon application
  • 12.
  • 13.
    Why Durable Functions?  Azure functions are stateless, to manage states in azure functions. You need Durable functions  Long running functions can be architected to run on Durable functions
  • 14.
    Why Durable Functions?  You can define workflows in code.  They can call other functions synchronously and asynchronously. Output from called functions can be saved to local variables
  • 15.
  • 16.
    Patterns in Azuredurable functions Function Chaining Fan in/Fan out Async Http API Monitoring Human Interaction
  • 17.
    Pattern #1: Functionchaining  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.
  • 18.
    Pattern #2: Fan-out/fan-in 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.
  • 19.
    Pattern #3: AsyncHTTP APIs  A common way to implement this pattern is by having the long-running action triggered by an HTTP call, and then redirecting the client to a status endpoint that they can poll to learn when the operation completes.
  • 20.
    Pattern #4: Monitoring The monitor pattern refers to a flexible recurring process in a workflow  Instead of exposing an endpoint for an external client to monitor a long- running operation, the long-running monitor consumes an external endpoint, waiting for some state change.
  • 21.
    Pattern #5: Humaninteraction  Involving humans in an automated process is tricky because people aren't as highly available and as responsive as cloud services.
  • 22.
    Demo on Azure Durablefunctions - Patterns
  • 23.
  • 24.
    Draw backs ofStandard Azure functions  In consumption mode, the azure functions has cold start  You cannot define the CPU type of your running process
  • 25.
    Premium Azure functions No cold start  VNet connectivity  Premium hardware  Elastic SKU
  • 26.
  • 27.
  • 28.
  • 29.
    Why Azure proxies?  Single URL for multiple apps  Build fake back end in minutes  Avoid CORS issues
  • 30.
  • 31.
  • 32.

Editor's Notes

  • #3 Functions can make development even more productive, and you can use your development language of choice, such as C#, F#, Node.js, Java, or PHP
  • #4 Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. Functions can make development even more productive, and you can use your development language of choice, such as C#, F#, Node.js, Java, or PHP
  • #7 * - Free and shared available but it is not always on and it has very less configuration relatively to your laptop in CPU and memory.
  • #23 https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-create-first-csharp