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

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

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

Presentation Slides for de:code 2019 CD02
Session Title: Azure Functions 2.0 Deep Dive - デベロッパーのための最新開発ガイド
Session Video: https://youtu.be/fyq48ciTkF8
Date: May 30, 2019

Moved from slideshare

Yoichi Kawasaki

May 29, 2019
Tweet

More Decks by Yoichi Kawasaki

Other Decks in Technology

Transcript

  1. de:code 2019 CD02 Azure Functions 2.0 Deep Dive '*+&) "!#"%$(

         
  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. 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
  4.  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
  5. il:nviPU 9pwnduPU7A)EK' (request)P(response)T@[]Z =S7I^J^T' _I^T' PU& T)EKnsxfbgrxPEN= pwnduO;]8il:nvi9pwnduOU7"T' A;LNX7I^J^TjkgrxT $Y_#

    F]CP_e:oS' ER< : Wikipedia – il:nv9ipwndu MW\7e:o:Obsa`xnT$_# HG7I^J^T' qkj:hA)END^] • qtkne:oObsa`xn$_# ER<TO(AgxpuSR \Sic:uEYFBR] • mqtkn bsa`xnOT !A '8*>VS?<NU7e:o OTil:n ,+/266354+-+# OURB7n:bx% ,.10RQ-TZ=R bsa`xnO# F]% SF] 'A;]
  6. • 3 /506JRIT.LV.< • U.:S-EGB<C.S • 2K@D7W=JQW9J?PW • HSF8W4A;NRD7O.> <TEW?MS

     • HSF8W+&(12,*'+&(14 • &&#")"%$$(" !)(14HSF8W
  7. 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
  8. 27+538+4.6 – Trigger & Binding ,/# (!& .-# ( &

    Function Code { "disabled":false, "bindings":[ // ... bindings here { "type": "bindingType", "direction": "in", "name": "myParamName", //more depending on binding } ] } ,80*6 ###1)*6$ ,/# % "'&
  9. (,% •    • Cold Start • !

    +, • ,!#,!ACU • ")+$ •  OS '!$,&*, Consumption Plan on Windows   App Service Plan on Linux   https://docs.microsoft.com/en-us/azure/virtual-machines/windows/acu
  10. functionTimeout Plan Scale Out: •  App Scale Out: •

       https://docs.microsoft.com/en-us/azure/azure-functions/functions-premium-plan
  11. 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
  12. https://github.com/kedacore/keda • 3$'0.'2'1D /0*5/.2#,/& 32/1%#,'0E/&D!FSTU  @PO8VK <ID9  •

    E#$$*2 6#(+# 20'#-*.)6 530'2/0#)' 3'3'6530''04*%' 31 3'3'BA  BMRWQC ; >/&DPO8V 9@:ID9  • 9"'0/PO8VMW7LNQ;?6=J ECGHPO8VMW7LNQ Storage Queue ServiceBus Queue Kafka RabbitMQ HPA KEDA 1->N or N->1 0->1 or 1->0 … K E D A
  13. ? ? ?   !27- 6+ 7# !27- 

       FIFO 0 6)57#3*(&7#   ,)!7&"'-Pub/Sub .+ %47    %716 Queue$/'
  14. 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)
  15.     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
  16. Durable Functions    IMAGE WORKS   

     https://customers.microsoft.com/ja- jp/story/fujifilm-manufacturing-azure- ai-functions-jp-japan
  17. ;HH9<GJECDKJ8] %!jYg • €‰you„Šbe`hX4b aRP\fApplication Insightsb 6jT  • ‰pM}nO‚ŠvMm…OzOxNaQ\5{ˆOv3`_)Tb3

    Live Metrics Stream Application Map    https://docs.microsoft.com/ja-jp/azure/azure-functions/functions-monitoring • sO~vb(j1/a,"V†wOv#'b$8b2.S3 • {…Štou„Šb&0-dZc b^`[Zk€†qOu„ŠbrŠO|Š{M (MdZc7j *a+WiU^S3 =ELB9>BKIEAJ9?KIB@F: †k‡xlƒaP ^+S3
  18. © 2018 Microsoft Corporation. All rights reserved. )(@-$%/SUK>=JDA/  <@E@<2G/,

    >5& 6IH 42GC80 © 2019 Microsoft Corporation. All rights reserved. )(@- ($%/SUK>=JD) A/de:code 2019  (2019!529~30 ) @E@<2G/, >5& 6IH 42GC80 )LUQUP@ /3FB)LUQUP?;5H"/*/TM/#/N1RO>=A9I:I/.'+?7C80 Y A X B
  19. 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
  20. Functions}Y…v`j_mo <& oFWSMVQTSp c`‡m • ~xo6(p /',mv>]X= gn‚xŠwy„z‹Yv$q 3#^Zu •

    9l?p4o„ŽY€jo2,^`lu €ƒY„Ž€iB-iZubj • FWSMVQTS1m€ƒY„v;dl[ • %o?4^o?mv>]ubjl`,dhr0e mlus\mfu |‹†|?v7au • |‹†|?p= gn‚xŠwy„z‹Yv$q 3#^Zu • KNLPTTRDGJJHŒ{z€„p"'mŽ€‰€v:fuo^5+iZtX*`lu!pGJJHC JUQOONUˆxY…v80 i?fubjv.fu AECC)IWNWNm@dh IWNWNCJUQOONU i?fulk 
  21.  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
  22. CNCF Serverless WGjbfgi_Ylx uqmXzc^fc & • ahpqt{ `clxuc'U*HKPENLMENABHJHPSU #Z$ •

    5AA>cyXrv|tkV4REKP.3NHREKpqt{ WtquVEPC/ • lxud[e\eaw~un}`b]h • +7??<-*29=<-*9=??-*>9?<,V;>>+8AFIA-*:2?>,VxsX% +2@>*8HKEOHO-*2TQNE*4REKP*6NHD,-*EPC/ GPPMO100CJLQDEREKPO/HL0 https://github.com/cloudevents/spec/blob/master/json-format.md ow}: CloudEvent JSON (data !Z")c()