Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Azure Functions 2.0 Deep Dive - デベロッパーのための最新開発ガイド

252 views

Published on

Slides for de:code 2019 CD02 session (May 30, 2019)
Session Title: Azure Functions 2.0 Deep Dive - デベロッパーのための最新開発ガイド

https://www.microsoft.com/ja-jp/events/decode/2019session/detail.aspx?sid=CD02

Published in: Technology
  • Be the first to comment

Azure Functions 2.0 Deep Dive - デベロッパーのための最新開発ガイド

  1. 1. de:code 2019 CD02 Azure Functions 2.0 Deep Dive
  2. 2. @yokawasa https://github.com/yokawasa Azure Technology Solution Professional J J s K B G At 2 2 1 027C N e D A K k B o n l b Ja G A K n pD , Obc About Speaker
  3. 3. Serverless & Azure Functions Overview
  4. 4. Serverless
  5. 5. Serverless https://martinfowler.com/articles/serverless.html BaaS ( Backend as a Service) FaaS ( Functions as a Service)
  6. 6. FaaS Serverless can also mean applications where server- side logic is still written by the application developer, but, unlike traditional architectures, it’s run in stateless compute containers that are event-triggered, ephemeral (may only last for one invocation), and fully managed by a third party. One way to think of this is “Functions as a Service” or "FaaS". https://martinfowler.com/articles/serverless.html
  7. 7. Infrastructure Host OS Hypervisor Guest OS Guest OS Guest OS Bins/ Libs Bins/ Libs Bins/ Libs App App App Infrastructure Host OS Container Engine Bins/ Libs Bins/ Libs Bins/ Libs App App App
  8. 8. (request) (response) : Wikipedia – • •
  9. 9. FaaS HTTP HTTPProxy
  10. 10. Serverless is cheaper, not simpler https://medium.freecodecamp.org/serverless-is-cheaper-not-simpler-a10c4fc30e49
  11. 11. • • • • • •
  12. 12. Room O - 14:50 - 15:40 (Day2)
  13. 13. Azure Functions 2.0 Runtime & Programming Model
  14. 14. Azure Functions Runtime Functions 1.X Runtime Functions 2.X Runtime gRPC
  15. 15. Runtime Azure Functions 1.X Azure Functions 2.X host extensions Functions code & config host Functions code & config extensions Microsoft.NET.Sdk.Functions (.NET Framework 4.6) • HTTP • Timer • Storage • Service Bus • EventHubs • Cosmos DB Microsoft.NET.Sdk.Functions (.NET Standard 2.0) • HTTP • Timer Microsoft.Azure.WebJobs.Extensions.Storage Microsoft.Azure.WebJobs.Extensions.ServiceBus Microsoft.Azure.Webjobs.Extensions.EventHubs Microsoft.Azure.WebJobs.Extensions.CosmosDB Microsoft.Azure.Webjobs.Extensions.EventGrid Microsoft.Azure.WebJobs.Extensions.DurableTask Microsoft.Azure.Webjobs.Extensions.MicrosoftGraph
  16. 16. – Trigger & Binding Function Code { "disabled":false, "bindings":[ // ... bindings here { "type": "bindingType", "direction": "in", "name": "myParamName", //more depending on binding } ] }
  17. 17. trigger – Blob → → Cosmos DB https://github.com/yokawasa/azure-functions-python-samples/tree/master/v2functions/blob-trigger-cosmosdb-out-binding Function trigger
  18. 18. https://docs.microsoft.com/en-us/azure/azure-functions/supported-languages https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings Cosmos DB Blob Storage Queue Storage Table Storage Service Bus Event Grid Event Hub HTTP Webhook Timer Microsoft Graph Mobile Apps SignalR
  19. 19. Functions • •
  20. 20. Azure Functions Hosting Options
  21. 21. • • Cold Start • • ACU • • OS Consumption Plan on Windows App Service Plan on Linux https://docs.microsoft.com/en-us/azure/virtual-machines/windows/acu
  22. 22. Consumption ( ) App Service Premium 2019 5
  23. 23. functionTimeout Plan Scale Out: • App Scale Out: • https://docs.microsoft.com/en-us/azure/azure-functions/functions-premium-plan
  24. 24. https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#runtime-scaling • Function App 200 • HTTP Trigger • NON-HTTP Trigger 30 [ ] Trigger 2019 5
  25. 25. https://docs.microsoft.com/ja-jp/azure/azure-functions/functions-host-json
  26. 26. https://azure.microsoft.com/en-us/blog/understanding-serverless-cold-start functions
  27. 27. • Warmup
  28. 28. azure functions runtime base image Language worker Language framework Azure Functions Azure Functions https://hub.docker.com/_/microsoft-azure-functions-base https://github.com/Azure/azure-functions-docker
  29. 29. + 2019 5
  30. 30. https://github.com/kedacore/keda • • • Storage Queue ServiceBus Queue Kafka RabbitMQ HPA KEDA 1->N or N->1 0->1 or 1->0 … K E D A
  31. 31. Functions • •
  32. 32. Azure Functions Best Practices
  33. 33. ? ? ? FIFO Pub/Sub Queue
  34. 34. … …
  35. 35. – • • •
  36. 36. Durable Functions Durable Function Overview https://docs.microsoft.com/ja-jp/azure/azure-functions/durable-functions-overview
  37. 37. F1 F2 F3 F4 Queue Queue Queue Durable Functions Durable Functions F1 F2 F3 F4 Orchestrator Function // calls functions in sequence public static async Task<object> Run(DurableOrchestrationContext ctx) { try { var x = await ctx.CallFunctionAsync("F1"); var y = await ctx.CallFunctionAsync("F2", x); var z = await ctx.CallFunctionAsync("F3", y); return await ctx.CallFunctionAsync("F4", z); } catch (Exception)
  38. 38. Function chaining Fan-out / fan-in Event aggregation Extended Status Monitoring http Async HTTP APIs Human interaction / timeout https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-concepts
  39. 39. Durable Functions IMAGE WORKS https://customers.microsoft.com/ja- jp/story/fujifilm-manufacturing-azure- ai-functions-jp-japan
  40. 40. trigger Function
  41. 41. https://docs.microsoft.com/en-us/azure/azure-functions/manage-connections
  42. 42. • https://stackoverflow.com/questions/48339829/async-programming-and-azure-functions • https://stackoverflow.com/questions/40409344/how-can-i-bind-output-values-to-my-async-azure-function/40409345#40409345 async await async Task.Run Task.Run NG await output return value Bind
  43. 43. • Application Insights • Live Metrics Stream Application Map https://docs.microsoft.com/ja-jp/azure/azure-functions/functions-monitoring • •
  44. 44. Collects and analyzes health, performance, and usage data
  45. 45. Azure DevOps Labs - https://azuredevopslabs.com/
  46. 46. © 2018 Microsoft Corporation. All rights reserved. © 2019 Microsoft Corporation. All rights reserved. ( ) de:code 2019 (2019 5 29~30 ) Y A X B
  47. 47. APPENDIX
  48. 48. https://github.com/Azure/azure-functions • Azure Functions Host - the Azure Functions runtime/host • Azure WebJobs SDK - the "core" of the Azure Functions runtime and many bindings • Azure WebJobs SDK extensions - the repositories of many bindings • Azure Functions Core Tools - the command line tool for Azure Functions • Azure Functions NodeJS Worker - support for running JavaScript functions • Azure Functions Java Worker - support for running Java functions • Azure Functions Python Worker - support for running Python functions • Azure Functions UX - the UX for the Functions development portal • Azure Functions templates - the templates which show up in the Azure Functions portal, Visual Studio, Visual Studio Code, etc • Azure Functions samples - repository for some samples on how the runtime works • Azure Functions VS Tooling - msbuild tasks for precompiled functions
  49. 49. https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/serverless/web-app https://github.com/mspnp/serverless-reference-implementation https://docs.microsoft.com/en-us/azure/architecture/reference-architectures/serverless/event-processing https://github.com/mspnp/serverless-reference-implementation
  50. 50. Functions • • • • • •
  51. 51. Queue 2019.05 Storage Queue Service Bus Queue https://docs.microsoft.com/ja-jp/azure/service-bus-messaging/service-bus-azure-and-service-bus-queues-compared-contrasted
  52. 52. CNCF Serverless WG • • • • https://github.com/cloudevents/spec/blob/master/json-format.md : CloudEvent JSON (data )

×