Upload
others
View
12
Download
0
Embed Size (px)
Citation preview
WebJobs & Azure Functions in modern and Serverless applicationsParis PolyzosSoftware Engineer at ZuluTrade IncMicrosoft Azure MVP
Paris PolyzosSenior Software EngineerMicrosoft Azure MVP
@ppolyzosppolyzos.comAzureHeads.gr
ns 2016The ZuluTrade Group
WebJobs, Azure Functions in modern Serverless applications
Goals
3
• What,whenandhowtousethe“Functions”programmingmodel
• WebJobsOverview• ServerlessComputing• AzureFunctionsOverview
WebJobs, Azure Functions in modern Serverless applications
What is the Functions programming model?
4
•Functionastheunitofwork•Functionsstart,executeandfinish•Functionshaveinputsandoutputs
WebJobs, Azure Functions in modern Serverless applications
Best Practices
5
Functionsshould:• doonething• beidempotent• finishasquicklyaspossible
WebJobs, Azure Functions in modern Serverless applications
How and when to use them?
6
Questions:1. Whatisthatyouwanttodo?2. Whattriggersthefunction?3. DoIneedadditionaldata?4. IsthereoutputIshouldproduce?
Conclude:“When__,get__,do__,andoutput__”.
WebJobs, Azure Functions in modern Serverless applications
Azure WebJobs
7
“AzureWebJobsprovideaneasywaytorunscriptsorprograms,ondemand,continuouslyoronaschedule,asbackgroundprocessesonAppServiceWebApps.”
WebJobsSDK providebindingsandtriggersystemwhichworkswithStorageBlobs,Queues,Tables,ServiceBus.
WebJobsExtensions
WebJobs, Azure Functions in modern Serverless applications
WebJobs Demo
8
DEMO
WebJobs, Azure Functions in modern Serverless applications
Serverless Computing
9
“Serverless architectures refer to applications that significantly depend on third-party services (knows as Backend as a Service or "BaaS") or on custom code that's run in ephemeral containers (Function as a Service or "FaaS")”
Martin Fowler
Benefits• ReducedOperational&DevelopmentCosts• FastandeasyScaling• ReducedPackaging&Deployment
Complexity• Easyscheduling&eventprocessing• Reducedtimetomarket/Experimentation
Drawbacks• Vendorcontrol• ExecutionDuration• UnitTesting• LimitedTooling
WebJobs, Azure Functions in modern Serverless applications
Azure Functions
10
Process events with serverless code• DevelopinanylanguageC#,node.js,F#,Python…• Scheduleevent-driventaskseasily• ExposeFunctionsasHttpAPIendpoints• Payonlyforwhatyouuse• ScaleFunctionsbasedondemand
WebJobs, Azure Functions in modern Serverless applications
Azure Functions Architecture
11
BuiltontopofAppService&WebJobsSDK
WebJobs, Azure Functions in modern Serverless applications
Azure Functions Platform & Pricing
12
Dedicated&DynamicTiers
Dedicated• Basic,Standard,PremiumAppServiceTiers• Paybasedon#ofreservedVMs• You areresponsibleforscaling
Dynamic• Paybasedon#ofexecutions• Platformresponsibleforscaling• Limits
Pricing(ReservedMemory✕ Duration)+NumberOfExecutions=xxx(GB-s)
WebJobs, Azure Functions in modern Serverless applications
Azure Functions
13
DEMO
WebJobs, Azure Functions in modern Serverless applications
WebJobs vs Azure Functions
14
CommonPoints
• Same“Functions”Programmingmodel• Supportbindingsfortriggers/inputs/outputs• WebJobsSDKextensionsmodel• Externallibrariessupport• Canrunlocallyandbedebugged• BothprovideruntimetelemetryviaDashboard
WebJobs, Azure Functions in modern Serverless applications
WebJobs vs Azure Functions
15
Programmingmodeldifferences
WebJobs§ Attributesforconfiguringbindings§ Traditional.NETdeveloperexperience(VisualStudio,NuGet,MSBuild)
§ Manyfunctionsperclass§ CanaccessandmanipulatemanycoreSDKfeatures
§ Can’tlistenforHTTPrequests*
AzureFunctions§ C#,Node.js,F#,Python§ Config filesforbindings§ Diversedevelopment(AzurePortal,VSCode)
§ SupportsHTTP
WebJobs, Azure Functions in modern Serverless applications
WebJobs vs Azure Functions
16
Hostingmodeldifferences
WebJobs• SupportsHostconfiguration• Buildaconsoleapp• You managescaling• RunstheserviceinthebackgroundofWeb/Mobile/APIapp
• Runsanyconsoleapp(notjustSDKbasedones)
AzureFunctions§ Limitedcontroloverthehost§ Justgiveityourcode/config§ Functionappownsthewholehost
§ Scaleismanagedforyou§ OnlyrunsAzureFunctionsstuff–nootherthings
Thank You
https://azure.microsoft.com/en-us/documentation/articles/websites-webjobs-resources/https://azure.microsoft.com/en-gb/services/functions/www.azureheads.grwww.ppolyzos.com
WebJobs, Azure Functions in modern Serverless applications
Supported Bindings
18
Type Service Trigger Input Output
Schedule AzureFunctions ✔
HTTP (RESTorWebHook) AzureFunctions ✔ ✔
BlobStorage AzureStorage ✔ ✔ ✔
Queues AzureStorage ✔ ✔
Tables AzureStorage ✔ ✔
Tables AzureMobileAppsEasyTables
✔ ✔
No-SQLDB Azure DocumentDB ✔ ✔
Streams AzureEventHubs ✔ ✔
PushNotifications AzureNotification Hubs ✔
SaaS Twillio,SendGrid(experimental)
✔