Pragmatische Serverless Microservices mit Azure Functions & Co. (Kaa Sörwa unn Söavis-Gschmarri – so Cloud-Gwerch hald)

Pragmatische Serverless Microservices mit Azure Functions & Co. (Kaa Sörwa unn Söavis-Gschmarri – so Cloud-Gwerch hald)

Das ist eine Hip, das andere ist Hype. Aber muss es Serverless *oder* Microservices sein? Vielmehr sollte es Microservices *mit* Serverless heißen. Basierend auf allgemein anerkannten Prinzipien können wir serverlose Architekturen und Technologien verwenden, um hochfokussierte Microservices ohne viel Infrastruktur-Tamtam zu erstellen - nennen wir sie der Einfachheit halber Nanoservices. Der Unterfranke und DDF-Pionier Christian Weyer zeigt euch einen pragmatischen Ansatz zum Erstellen von Nanoservices mit Azure Functions, Azure Service Bus, Azure Storage und weiteren Cloud-Diensten & Tools. Erleben Sie Serverless Azure in Aktion mit .NET Core, JavaScript und Java in bester Cross-Plattform-Manier - auf dem Server, äh.... #KaaSörwa

7e0087a19318ded4ba2203187694740f?s=128

Christian Weyer

April 06, 2019
Tweet

Transcript

  1. Kaa Sörwa unn Söavis-Gschmarri – so Cloud-Gwerch hald Pragmatische Serverless

    Microservices mit Azure Functions & Co. Christian Weyer @christianweyer CTO
  2. 2 § Founder & CTO at Thinktecture AG § Personal

    focus on § Mobile & web-based application architectures § Interoperability, cross-device § Pragmatic end-to-end solutions § Cloud-native & serverless architectures § Independent Microsoft Regional Director § Microsoft MVP for ASP.NET (Architecture) ASPInsider, AzureInsider § Google GDE for Web Technologies christian.weyer@thinktecture.com @christianweyer https://www.thinktecture.com Christian Weyer Azure Functions & Co. Pragmatische Serverless Microservices
  3. 3 § Microservices, Nanoservices § Serverless in Azure § Serverless

    Compute: Azure Functions § Serverless Messaging: Azure Service Bus § Azure Functions Extensibility § Summary Pragmatische Serverless Microservices Azure Functions & Co. Our Journey Today
  4. How large is small? Microservices Azure Functions & Co. Pragmatische

    Serverless Microservices 4
  5. Single Responsibility § Focused around business domain § ‘Small’ Isolation

    § Well-defined technology-agnostic API § Mobility § Choice of technology Autonomy § Exclusive state (data storage) Decoupling § Asynchronous communication § Really, always? Pragmatische Serverless Microservices Azure Functions & Co. (Some) Principles of Microservices 5
  6. Pragmatische Serverless Microservices Azure Functions & Co. Sample Architecture –

    Shopping Order Monitoring 6 Orders Service Products Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman) 1 - authenticate 2 - register for push 3 - send new order 5 - new order created push 6 - get updated orders 4 - processing order…
  7. A different approach Serverless Azure Functions & Co. Pragmatische Serverless

    Microservices 7
  8. 8 § We can choose from a continuum § VM

    ➔ § Containers ➔ § Orchestrators ➔ § PaaS ➔ § Serverless Pragmatische Serverless Microservices Azure Functions & Co. Evolution to Cloud Compute Continuum PaaS IaaS On-Premises Serverless
  9. 9 What Do We Want – With & From Serverless?

    Programming Model (FaaS) § Event-driven § Stateless § Service-full Operational Model § Fully managed § Automatically scaling § Usage priced Azure Functions & Co. Pragmatische Serverless Microservices
  10. 10 § Serverless Compute → Azure Functions § Serverless Database

    → Azure Cosmos DB § Serverless Storage → Azure Storage § Serverless Realtime → Azure SignalR Service § Serverless Events → Azure Event Grid § Serverless Messaging → Azure Service Bus § Serverless Workflows → Azure Logic Apps Azure Durable Functions § Serverless IoT → Azure IoT Hub § Serverless Analytics → Azure Application Insights § Serverless Containers → Azure Container Instances Pragmatische Serverless Microservices Azure Functions & Co. Serverless in Azure (my personal choice)
  11. Pragmatische Serverless Microservices Azure Functions & Co. Sample Architecture –

    Shopping Order Monitoring: Serverless 11 Orders Service Products Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman) Azure Function App – C# Azure Function App - C# Azure Function App - JS Azure Function App - Java Azure Service Bus Azure Blob Storage Azure SignalR Service Azure Table Storage Azure Cosmos DB Identity Server
  12. Azure Functions Serverless Compute Azure Functions & Co. Pragmatische Serverless

    Microservices 12
  13. 13 § Azure Functions: code being triggered by an event

    § Use Façade pattern for your business logic § Basic principles enable powerful use cases § Events ➔ Triggers & Bindings § Two ways of operation § Cost-optimized, automatic scale (Consumption plan) § Always-on (App Service plan) § V2 Runtime built on .NET Core § Available for self-hosting § Local tooling & runtime § Multiple language bindings supported Pragmatische Serverless Microservices Azure Functions & Co. Azure Functions: Functions-as-a-Service
  14. 14 § Incoming event triggers function § Input bindings enable

    easy access to data from various data sources § Output bindings offer easy access to outbound data sinks Pragmatische Serverless Microservices Azure Functions & Co. Functions Triggers & Bindings Your code logic Runtime Azure Function HTTP Trigger Storage Input Binding Push Notification Output Binding Database Output Binding Email Output Binding Example
  15. 15 Functions Triggers & Bindings in Code Azure Functions &

    Co. Pragmatische Serverless Microservices
  16. 16 § Azure Functions host instances are automatically managed §

    Spawning new instances → cold start § Reusing existing instances → warm start Pragmatische Serverless Microservices Azure Functions & Co. Scalability: Cold vs. Warm Start https://azure.microsoft.com/en-us/blog/understanding-serverless-cold-start/
  17. Azure Service Bus Serverless Messaging Azure Functions & Co. Pragmatische

    Serverless Microservices 17
  18. 18 § Queues & Topics § Reliable asynchronous communication §

    Rich features for temporal control § Routing and filtering § Transactions § Convoys & Sessions (related messages with state) § Bindings for Azure Functions available Pragmatische Serverless Microservices Azure Functions & Co. Service Bus: Messaging-as-a-Service
  19. 19 Sender § Sender sends message to queue § Queue

    ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) Pragmatische Serverless Microservices Azure Functions & Co. Service Bus Queues Receiver
  20. 20 § Sender only knows about Topic § Receivers only

    know about Subscriptions § Filters and Actions exist on Subscriptions Pragmatische Serverless Microservices Azure Functions & Co. Service Bus Topics & Subscriptions Type == ‘order‘ Sender type=quote type=order Topic Type == ‘quote‘ Filter Filter Subscrip- tion 1 Subscrip- tion 2
  21. Azure Functions Extensibility Custom Bindings & Triggers Azure Functions &

    Co. Pragmatische Serverless Microservices 21
  22. 22 § Connecting your own data sources and data sinks

    to Azure Functions § Beyond available bindings & triggers § We can implement custom bindings § Input § Output § Triggers (with limitations) § E.g. build input binding for your own ERP system – or SQL Server § E.g. provide output binding for Web Push protocol (used in PWAs) Pragmatische Serverless Microservices Azure Functions & Co. Azure Functions Custom Bindings & Triggers
  23. Summary Azure Functions & Co. Pragmatische Serverless Microservices 23

  24. Single Responsibility § Focused around business domain § ‘Small’ unit

    ➡ Dedicated Azure Functions App ➡ Dedicated Azure DevOps Pipeline Isolation § Choice of technology ➡ .NET, Java, node.js, Python supported § Well-defined technology-agnostic APIs ➡ HTTPS, AMQP, MQTT, custom § Mobility ➡ Portable runtime ➡ Can use Docker, k8s with Functions ➡ Easily deploy & run in Cloud Autonomy § Exclusive state (data storage) ➡ Use separate Azure Storage, Azure SQL, Azure CosmosDB instances Decoupling § Asynchronous communication ➡ Azure Service Bus with queues or topics & subscriptions Pragmatische Serverless Microservices Azure Functions & Co. (Some) Principles of Microservices – with Serverless Azure 24
  25. Pragmatische Serverless Microservices Azure Functions & Co. https://twitter.com/swardley/status/1024764547436085249 25

  26. 26 § Serverless (as FaaS) is just one option in

    the Cloud Continuum § Always think about the use cases and requirements § Serverless hosting model will be pre-dominant on the ‘server’ in a couple of years for many use cases § Serverless Azure tries to offer solutions in the Serverless space § Storage § Functions § Service Bus § SignalR Service & more § Azure Functions is way more than just a Web API framework – preferred for async decoupled processing Pragmatische Serverless Microservices Azure Functions & Co. Summary
  27. 27 Remember: there are NO servers! https://twitter.com/jeffhollan/status/1030244102082682880 Azure Functions &

    Co. Pragmatische Serverless Microservices
  28. Chris&an Weyer, Thinktecture AG @chris&anweyer chris&an.weyer@thinktecture.com h:ps://github.com/thinktecture/serverless-microservices h:ps://github.com/thinktecture/azure-func&ons-extensibility