Successfully reported this slideshow.
Your SlideShare is downloading. ×

SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS

SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS

Download to read offline

When it comes to microservice architecture, sometimes all you wanted is to perform cross cutting concerns ( logging, authentication , caching, CORS, Routing, load balancing , exception handling , tracing, resiliency etc..) and also there might be a scenario where you wanted to perform certain manipulations on your request payload before hitting into your actual handler. And this should not be a repetitive code in each of the services , so all you might need is a single place to orchestrate all these concerns and that is where Middleware comes into the picture. In the demo I will be covering how to orchestrate these cross cutting concerns by using Azure functions as a Serverless model.

When it comes to microservice architecture, sometimes all you wanted is to perform cross cutting concerns ( logging, authentication , caching, CORS, Routing, load balancing , exception handling , tracing, resiliency etc..) and also there might be a scenario where you wanted to perform certain manipulations on your request payload before hitting into your actual handler. And this should not be a repetitive code in each of the services , so all you might need is a single place to orchestrate all these concerns and that is where Middleware comes into the picture. In the demo I will be covering how to orchestrate these cross cutting concerns by using Azure functions as a Serverless model.

More Related Content

More from CodeOps Technologies LLP

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

SERVERLESS MIDDLEWARE IN AZURE FUNCTIONS

  1. 1. © Copyright Microsoft Corporation. All rights reserved. Serverless Middleware in Azure Functions Divakar Kumar Senior Software Engineer @Prokarma https://www.linkedin.com/in/divakar-kumar/ https://github.com/Divakar-kumar
  2. 2. 👋 Hi https://www.linkedin.com/in/divakar-kumar/ https://github.com/Divakar-kumar 🏆 Certifications: ✔️ Microsoft Certified Trainer ✔️ Microsoft Certified: DevOps Engineer Expert ✔️ Microsoft Certified: Azure Developer Associate ✔️ Microsoft Certified: Azure IoT Developer Specialty ✔️ Microsoft Certified: Azure Fundamentals ✔️ Aviatrix Certified Engineer - Multi-Cloud Network Associate 👨‍ 💻
  3. 3. © Copyright Microsoft Corporation. All rights reserved. Agenda Middleware Serverless Architecture Middleware compatibility in Azure functions Demo Recreate middleware pipeline in current runtime Microsoft Announcement
  4. 4. © Copyright Microsoft Corporation. All rights reserved. Middleware
  5. 5. • Handle HTTP Request or Response • Holds HTTP context and Requestdelegate • In ASP .NET core we have 3 middleware options • Use() • Run() • Map() • Process an incoming HTTP request, modify it, and pass it on to another piece of middleware. • Handle an incoming HTTP request by generating an HTTP response. • Reroute an incoming HTTP request to another middleware or web server Middleware & Configuration options
  6. 6. ASP.NET Core in Action - What is middleware? Andrew https://andrewlock.net/asp-net-core-in-action-what-is-middleware/
  7. 7. © Copyright Microsoft Corporation. All rights reserved. Agenda Middleware Serverless Architecture Middleware compatibility in Azure functions Demo Recreate middleware pipeline in current runtime Microsoft Announcement
  8. 8. ©Microsoft Corporation Azure • Low management overhead • Pay per use • Elastically scalable Benefits
  9. 9. Serverless to the Max: Doing Big Things for Small Dollars with Cloudflare Workers and Azure Functions - Troy https://www.troyhunt.com/serverless-to-the-max-doing-big-things-for-small- dollars-with-cloudflare-workers-and-azure-functions/ Don’t use Azure Functions as a web application - Maarten https://blog.maartenballiauw.be/post/2019/10/02/dont-use-azure-functions-as- a-web-application.html
  10. 10. ©Microsoft Corporation Azure • Logging • Exception handling • Tracing • CORS • Authentication • Authorization • Caching • Data validation • Monitoring • Health check Challenges in Serverless Architecture
  11. 11. © Copyright Microsoft Corporation. All rights reserved. Agenda Middleware Serverless Architecture Middleware compatibility in Azure functions Demo Recreate middleware pipeline in current runtime Microsoft Announcement
  12. 12. ©Microsoft Corporation Azure • Tightly coupled • Target framework • Dependent on host .NET runtime version • In-process model • Access to invocation pipeline is not possible Middleware compatibility in Azure Functions (1.x to 3.x )
  13. 13. © Copyright Microsoft Corporation. All rights reserved. Agenda Middleware Serverless Architecture Middleware compatibility in Azure functions Demo Recreate middleware pipeline in current runtime Microsoft Announcement
  14. 14. ©Microsoft Corporation Azure
  15. 15. © Copyright Microsoft Corporation. All rights reserved. Out-of-process Model
  16. 16. ©Microsoft Corporation Azure Out-of-process model • Proxies through IIS • Built in kestrel web server in ASP .NET core • Edge server • Performance issues
  17. 17. ASP.NET Core In Process Hosting on IIS with ASP.NET Core - Rick https://weblog.west-wind.com/posts/2019/Mar/16/ASPNET-Core-Hosting-on-IIS- with-ASPNET-Core-22
  18. 18. © Copyright Microsoft Corporation. All rights reserved. .NET 5 Worker Process
  19. 19. ©Microsoft Corporation Azure • Standalone Process • Decouples .NET function from Azure function host • Out of process model .NET 5 worker process
  20. 20. © Copyright Microsoft Corporation. All rights reserved. Visualizing .NET 5 worker process in Azure Functions
  21. 21. ©Microsoft Corporation Azure .NET 5 worker process model • 2 separate process • gRPC communication • Preview stage
  22. 22. © Copyright Microsoft Corporation. All rights reserved. Benefits of .NET5 worker process
  23. 23. ©Microsoft Corporation Azure • Fewer conflicts • Full control of the process • Dependency injection Benefits
  24. 24. ©Microsoft Corporation Azure Azure Functions Roadmap
  25. 25. © Copyright Microsoft Corporation. All rights reserved. Required Artifacts - .NET 5 Azure Function App
  26. 26. local.settings.json FunctionApp.csproj
  27. 27. Nuget packages:
  28. 28. Glance at Program.cs file :
  29. 29. Configureworker:
  30. 30. Demonstration: .NET 5 worker process • Run local solution • Host in azure functions
  31. 31. © Copyright Microsoft Corporation. All rights reserved. Agenda Middleware Serverless Architecture Middleware compatibility in Azure functions Demo Recreate middleware pipeline in current runtime Microsoft Announcement
  32. 32. • Understanding OWIN • Guide for Running Azure Functions on .NET 5 • .NET on Azure Functions Roadmap • Source Code – Serverless Middleware • Learn (http://aka.ms/learn)
  33. 33. Thank you! Danke Grazie Obrigado Gracias Teşekkürler ありがとう धन्यवाद Merci 感謝你 唔該 ‫شكر‬ Kiitos 감사합니다 Takk Dzięki ‫مرسي‬ Спасибо Ευχαριστώ

×