Getting Started with Serverless Architectures using Azure Functions @ TechDays 2017

Getting Started with Serverless Architectures using Azure Functions @ TechDays 2017

The presentation I gave at TechDays 2017 in Amsterdam.
First, the concepts of serverless architectures are explained. Then Azure Functions is introduced. The corresponding demo code can be found at https://github.com/marcduiker/demos-serverless-architectures-functions.

Fd55de4174accaf3b4f030e43a8a70c6?s=128

Marc Duiker

October 12, 2017
Tweet

Transcript

  1. 4.

    Current situation - Problems Client PlaceOrder Search ValidateOrder CalculatePrice Orders

    Products Prices Expensive infrastructure Performance issues Teams require synced delivery
  2. 5.

    POC to redesign – Conditions & Requirements Client PlaceOrder Search

    ValidateOrder CalculatePrice Orders Products Prices Uneven & spikey workload 2 weeks Limited budget Fault tolerant Independent delivery
  3. 6.
  4. 7.
  5. 9.

    1. Application that fully depends on a 3rd party service

    in the cloud to manage logic and state. Multiple interpretations for Serverless
  6. 10.

    2. Application where some code is written by the developer

    but is run in stateless compute containers that are event-triggered, short lived and fully managed by a 3rd party. Multiple interpretations for Serverless
  7. 11.

    • Serverless is a misleading term • Functions as a

    Service (FaaS) is better “Serverless”
  8. 13.

    Serverless architecture with FaaS Client PlaceOrder Gateway Search Validate Order

    Calculate Price Temp Storage Perm Storage Products Prices
  9. 15.

    What we all want • A responsive application • Regardless

    of workload • Regardless of failures
  10. 17.

    Serverless architecture with FaaS Client Temp Storage Gateway Search Products

    PlaceOrder Perm Storage Calculate Price Prices Validate Order
  11. 18.

    Serverless architecture with FaaS Client Temp Storage Gateway Search Products

    PlaceOrder Perm Storage Calculate Price Prices Validate Order
  12. 19.

    Benefits of FaaS • Focus on code instead of servers

    & runtime • Node.js , Python, C#, Java … • Reduced operational costs • Allows easier experimentation • Shorter time to market
  13. 20.

    Benefits of FaaS • Consumption based pricing • Resource consumption

    & number of executions # Executions / month 2m Time / execution 0.5 sec Time consumption 2m * 0.5 = 1m sec Avg memory consumption 1.5 GB Resource consumption 1.5 * 1m = 1.5m GB-s Resource price* 0.000014 Eur / GB-s Resource costs 1.5m * 0.000014 = 21 EUR Execution price* 0.169 EUR/1m executions Execution costs 2m * 0.169 = 0.34 EUR *Based on Azure Functions consumption plan dd 11 Oct 2017 2 1
  14. 21.

    Benefits of FaaS • Automatic scaling • Can reduce compute

    costs for spikey workloads constant spikey
  15. 22.
  16. 25.

    What is Azure Functions? “Azure Functions is a serverless compute

    service that enables you to run code on-demand without having to explicitly provision or manage infrastructure.” https://docs.microsoft.com/en-us/azure/azure-functions/
  17. 30.

    Differences with WebJobs • Seamless integration with Azure services •

    Azure Storage (Queues, Blobs) • Service Bus (Queues, Topics) • CosmosDB • Event Hubs • Webhooks • Timer • Consumption based pricing • Improved automatic scaling
  18. 34.

    • Function scripts - Directly in the portal - Visual

    Studio Code • Compiled Functions - Visual Studio 2017 with Azure Function Tools Developing Functions
  19. 36.

    Benefits of Compiled Functions: • Enjoy the VS IDE features

    • Local debugging • Easier package management • Configure CI/CD pipelines • Reduce cold start time Developing in Visual Studio
  20. 38.

    User uploads image Image requires validation Image needs to be

    analyzed Analysis result need to be stored Use case
  21. 39.

    Solution using Azure Functions & Queues images input images to

    analyze images too large analysis results to store validate analyze store blob DB
  22. 40.

    Solution using Azure Functions & Queues Upload images images input

    images to analyze images too large analysis results to store validate analyze store blob DB
  23. 41.

    Solution using Azure Functions & Queues Validate images images input

    images to analyze images too large analysis results to store validate analyze store blob DB
  24. 42.

    Solution using Azure Functions & Queues Analyze images images input

    images to analyze images too large analysis results to store validate analyze store blob DB
  25. 43.

    Solution using Azure Functions & Queues Store analysis data images

    input images to analyze images too large analysis results to store validate analyze store blob DB
  26. 44.

    Solution using Azure Functions & Queues Scope of the demo

    images input images to analyze images too large analysis results to store validate analyze store blob DB
  27. 46.
  28. 47.

    Solution using Azure Functions & Queues Start situation images input

    images to analyze images too large analysis results to store validate analyze store blob DB 3 3
  29. 48.

    Solution using Azure Functions & Queues End situation images input

    images to analyze images too large analysis results to store validate analyze store blob DB 3 1 2
  30. 50.

    ✓ Develop function using the Azure portal ✓ Develop function

    using Visual Studio ✓ Multiple functions in one Function App ✓ Microsoft Azure Storage Explorer ✓ Function App Logs Developing Functions Demos
  31. 52.

    Edit & save scripts in Portal Publish from Visual Studio

    Deploy straight from source control Deploy from VSTS Deploying Functions
  32. 56.

    Currently you need to provide a message queue to chain

    functions. Function Chaining & Durable Functions
  33. 57.

    Function Chaining & Durable Functions https://azure.github.io/azure-functions-durable-extension/ Durable Functions will use

    Orchestrator and Action functions making it easier for developers to chain functions.
  34. 59.

    Use an API gateway to manage your Functions API Gateway

    Client PlaceOrder Search Validate Calculate Temp Storage Perm Storage Products Gateway
  35. 60.
  36. 61.

    Marc Duiker Lead Consultant Xpirit Netherlands @marcduiker – mduiker@xpirit.com Go

    and discover endless possibilities with Azure Functions! https://github.com/marcduiker/ demos-serverless-architectures-functions/