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

NDC Oslo 2021 - Developer Fundamentals of Serve...

NDC Oslo 2021 - Developer Fundamentals of Serverless .NET Development of Azure Durable Functions

Jonah Andresson's speaker deck and presentation copy at the NDC Oslo 2021, session titled "Developer Fundamentals of Serverless.NET Development with Azure Durable Functions"

https://ndcoslo.com/agenda/developer-fundamentals-of-serverlessnet-development-with-azure-durable-functions-0ofz/0kyo3pv2spp

About Session:
Learn more about how you can get started in developing stateful functions with Microsoft Azure Durable Functions in a serverless environment in .NET. Find out the fundamental concepts you need to know to get started coding serverless in Azure, Durable Function Patterns, a few code samples and some recommended learning

About Jonah Andersson:

Jonah Andersson is a Filipina-Swedish full-stack Software Engineer, Azure Developer and Microsoft Azure MVP in Sweden.

She works as an Enterprise Software Engineer Consultant at Forefront Consulting in Sweden. She is also the founder and community leader of Azure User Group Sweden. Jonah studied Computer Science and Agile System Development in .NET and Java, which makes her very passionate about tech. She likes solving challenging problems, programming back-end and has great interest in developing in .NET with new cloud technologies in Microsoft Azure. She believes in continuous learning and collaboration with developers. Sharing technical knowledge at work and to the tech communities through public speaking and by mentoring others. Jonah is also passionate about making a difference by advocating gender equality, diversity and inclusion in tech.

Twitter: https://www.twitter.com/cjkodare
LinkedIn: https://www.linkedin.com/in/jonahandersson
Blog: https://jonahandersson.tech
Azure User Group Sweden: https://www.meetup.com/azureusergroupsundsvallsverige/

Jonah Andersson

July 27, 2022
Tweet

Other Decks in Technology

Transcript

  1. Hi, I’m Jonah Andersson! ☺ ▪ Software Engineer/Developer ▪ Full

    stack .NET ▪ Certified Azure Developer ▪ Microsoft MVP – Azure ▪ Microsoft Technical Trainer ▪ Founder/Community Leader of Azure User Group Sweden ▪ I mentor to inspire others into tech!
  2. 5 Scenario: 5 Philosophers, 5 Chopsticks A philosopher needs both

    Chopsticks - on left and right to eat. Otherwise, he/she can’t The Dining Philosophers Problem PROBLEMS: • Deadlock • Starvation
  3. 6 Have you been deadlocked? A deadlock is a condition

    where a program cannot access a resource it needs to continue. When an active application hits a deadlock, it may "hang" or become unresponsive. https://techterms.com/definition/deadlock
  4. What is really Serverless? Abstraction of servers and infrastructures Break

    logic into functions Focus on developer productivity Autoscaling Great integration Consumption model (Pay-as-You-Go) Automation of processes
  5. Azure Functions Azure Serverless Compute Service On-Demand , Pay-as-you-Go Event-Driven

    Focus on logic = Developer productivity Integration with other services & APIs Azure Functions
  6. Azure Durable Functions Extension of Azure Functions Stateful Workflows in

    Serverless Environments Manages, Checkpoints and Restarts State for you Durable Task Framework https://github.com/Azure/durabletask C#, Javascript, Python, F#, Powershell
  7. The Orchestrator is our FRIEND but STRICT! More info about

    Deterministic APIs: https://docs.microsoft.com/en-us/azure/azure- functions/durable/durable-functions-code- constraints#using-deterministic-apis DETERMINISTIC!
  8. Orchestrator Code Constraints – DONTs & DOs Dont generate random

    numbers or GUIDs NewGuid() method Dont access data stores like databases and configurations Blocking APIs - Threads like Sleep, Run or Delay Dont create Infinite Loops! CreateAsNew() Pass configurations into Activity function Use DurableOrchestrationContext Dont use CurrentDateTime Use.CurrentUtcDateTime() https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-code-constraints
  9. Application Patterns of Azure Durable Functions Function Chaining Fan out

    / Fan in Async HTTP API Monitor Human Interaction Aggregator
  10. Function Chaining Pattern F1 F2 F4 F3 Execute a sequence

    of functions in a particular order like a chain! Output of F1 is required input of F2, so on!
  11. Orchestrator STARTED Activity 1 SCHEDULED Orchestrator SLEEPS! Activity 1 DONE

    Orchestrator WAKES UP! Activity 2 SCHEDULED Activity 2 DONE Orchestration COMPLETED Orchestrator SLEEPS! Function Chaining in ACTION!
  12. Fan Out / Fan In Pattern Execute multiple functions in

    parallel and then wait for all functions to finish and aggregate the results when done.
  13. Async HTTP APIs Pattern Start DoWork GetStatus Solves the problem

    of coordinating the state of long-running operations with external clients Use HTTP Endpoint trigger the long running action Redirect a client to a status endpoint
  14. Monitor Pattern ▪ Flexible, recurring process in a workflow ▪

    Polling until specific conditions are met ▪ Use Case: Periodic job clean up
  15. Developing Azure Functions Visual Studio or VS Code Azure Portal,

    Azure CLI Azure Functions Core Tools https://github.com/Azure/azure-functions-core-tools A client for web requests like a web browser or Postman Azure Storage Explorer (Local Dev) Supported Languages C#, Java, Powershell, Python, Typescript, etc.
  16. Fullstack Development with Azure Functions Azure Static Web Apps –

    React, Blazor, Vue.js, etc. API support – Azure Static Web Apps with Azure Functions Bring Your Own Functions
  17. Coding Durable Functions – Good to know & have! Azure

    Application Insights Concious Versioning Side-by-Side Deployment Deployment with Breaking Change Azure Storage Explorer Deployment Slots Azure Key Vault / Configurations https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-versioning
  18. Error Handling – FunctionFailedException() Call another function activity Use Automatic

    Retry on Failure – CallActivityWithRetryAsync() Try-Catch Blocks https://docs.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-error-handling Durable Timer ( context.CreateTimer()) .NET App Logging / Application Insights Durable Functions Monitor https://github.com/scale-tone/DurableFunctionsMonitor#durable-functions-monitor
  19. Deployment & CI /CD Azure Function App (Windows + Linux)

    Azure Function App Container Azure Container Registry GitHub Actions/Workflow ARM Templates PubXml
  20. Azure Container Apps (Preview) MS Docs: https://docs.microsoft.com/en-us/azure/container-apps/ Fully managed serverless

    container service Built for Microservices scales dynamically based on HTTP traffic, events, and long- running background jobs Full support for KEDA and DAPR
  21. Demo - Serverless Function Chaining Example F1 F2 F3 Azure

    BLOB Trigger Orchestrator Function Starts Orchestration SendMessageToServiceBus() SendSMSCallviaTwilio() SendNotificationEmail() https://github.com/jonahandersson/serverlesslab-azure-durable-functionchaining-template
  22. Learning Resources • http://aka.ms/azurefunctions • Microsoft Learn – Azure Functions

    • Get updates via Twitter @AzureFunctions • Azure Functions University by Marc Duiker https://bit.ly/az-func-uni-playlist (YouTube) https://bit.ly/az-func-uni (GitHub) • https://github.com/Azure/azure-functions-durable-extension • Azure Serverless Community Library https://www.serverlesslibrary.net/
  23. As a developer, I Serverless because I can solve complex

    problems, build modern apps and it makes me productive!