Upgrade to Pro — share decks privately, control downloads, hide ads and more …

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.

Marc Duiker

October 12, 2017
Tweet

More Decks by Marc Duiker

Other Decks in Programming

Transcript

  1. Current situation - Problems Client PlaceOrder Search ValidateOrder CalculatePrice Orders

    Products Prices Expensive infrastructure Performance issues Teams require synced delivery
  2. 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. 1. Application that fully depends on a 3rd party service

    in the cloud to manage logic and state. Multiple interpretations for Serverless
  4. 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
  5. • Serverless is a misleading term • Functions as a

    Service (FaaS) is better “Serverless”
  6. Serverless architecture with FaaS Client PlaceOrder Gateway Search Validate Order

    Calculate Price Temp Storage Perm Storage Products Prices
  7. What we all want • A responsive application • Regardless

    of workload • Regardless of failures
  8. Serverless architecture with FaaS Client Temp Storage Gateway Search Products

    PlaceOrder Perm Storage Calculate Price Prices Validate Order
  9. Serverless architecture with FaaS Client Temp Storage Gateway Search Products

    PlaceOrder Perm Storage Calculate Price Prices Validate Order
  10. 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
  11. 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
  12. Benefits of FaaS • Automatic scaling • Can reduce compute

    costs for spikey workloads constant spikey
  13. 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/
  14. 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
  15. • Function scripts - Directly in the portal - Visual

    Studio Code • Compiled Functions - Visual Studio 2017 with Azure Function Tools Developing Functions
  16. 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
  17. User uploads image Image requires validation Image needs to be

    analyzed Analysis result need to be stored Use case
  18. Solution using Azure Functions & Queues images input images to

    analyze images too large analysis results to store validate analyze store blob DB
  19. Solution using Azure Functions & Queues Upload images images input

    images to analyze images too large analysis results to store validate analyze store blob DB
  20. Solution using Azure Functions & Queues Validate images images input

    images to analyze images too large analysis results to store validate analyze store blob DB
  21. Solution using Azure Functions & Queues Analyze images images input

    images to analyze images too large analysis results to store validate analyze store blob DB
  22. 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
  23. 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
  24. 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
  25. 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
  26. ✓ 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
  27. Edit & save scripts in Portal Publish from Visual Studio

    Deploy straight from source control Deploy from VSTS Deploying Functions
  28. Currently you need to provide a message queue to chain

    functions. Function Chaining & Durable Functions
  29. 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.
  30. Use an API gateway to manage your Functions API Gateway

    Client PlaceOrder Search Validate Calculate Temp Storage Perm Storage Products Gateway
  31. Marc Duiker Lead Consultant Xpirit Netherlands @marcduiker – [email protected] Go

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