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

Serverless-Architekturen: Event-getriebene Microservices mit Azure Functions & Co. – auch für Java-Entwickler

Serverless-Architekturen: Event-getriebene Microservices mit Azure Functions & Co. – auch für Java-Entwickler

Wie bitte? Microsofts Azure Cloud auf der JAX? Ja, in der Tat. Denn nicht immer muss oder soll es AWS (Amazon Web Services) oder GCP (Google Cloud Platform) sein. Azure bietet mittlerweile eine holistische Plattform für so gut wie jede Cloud-Anforderung an. Auch und vor allem in den Bereichen Cloud Native und Serverless investiert Microsoft sehr viel. In dieser Session zeigt Christian Weyer von Thinktecture – ohne großes Marketing-Tamtam – neben den Grundlagen vor allem typische Anwendungsszenarien für Azure Functions, Azure Service Bus und Co. Fokus soll dabei auf Event-getriebene Microservices-Architekturen liegen. Lehnen Sie sich also zurück und sehen Sie "die andere Cloud" – auch mit Java – in Action.

Christian Weyer

May 08, 2019
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. 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 [email protected] @christianweyer https://www.thinktecture.com Christian Weyer Serverless-Architekturen Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler
  2. 3 § Microservices, Nanoservices § Serverless in Azure § Serverless

    Compute: Azure Functions § Serverless Messaging: Azure Service Bus § Summary Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Our Journey Today
  3. 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? Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen (Some) Principles of Microservices 5
  4. Event-getriebene Microservices mit Azure Functions und Co. – auch für

    Java-Entwickler Serverless-Architekturen Sample Architecture – Shopping Order Monitoring 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… 6
  5. 8 § We can choose from a continuum § VM

    ➔ § Containers ➔ § Orchestrators ➔ § PaaS ➔ § Serverless Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Evolution to Cloud Compute Continuum PaaS IaaS On-Premises Serverless
  6. 9 What Do We Want – With & From Serverless?

    Programming Model (FaaS) § Event-driven § Stateless § Service-full Operational Model § Fully managed § Automatically scaling § Usage priced Serverless-Architekturen Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler
  7. 10 § Serverless Compute → Azure Functions § Serverless SQL

    Database → Azure SQL Serverless (Preview) § Serverless NoSQL 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 Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Serverless in Azure (my personal choice)
  8. Event-getriebene Microservices mit Azure Functions und Co. – auch für

    Java-Entwickler Serverless-Architekturen Sample Architecture – Shopping Order Monitoring: Serverless 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 11
  9. 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 Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Azure Functions: Functions-as-a-Service
  10. 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 Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen 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
  11. 16 § Azure Functions host instances are automatically managed §

    Spawning new instances → cold start § Reusing existing instances → warm start Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Scalability: Cold vs. Warm Start https://azure.microsoft.com/en-us/blog/understanding-serverless-cold-start/
  12. 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 Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Service Bus: Messaging-as-a-Service
  13. 19 Sender § Sender sends message to queue § Queue

    ACKs receipt § Receiver connects to queue & retrieves message § Receiver ACKs complete (or other action) Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Service Bus Queues Receiver
  14. 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 Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen (Some) Principles of Microservices – with Serverless Azure 21
  15. 22 § Serverless (as FaaS) is just one option in

    the Cloud Continuum § Always think about the use cases and requirements § We can build Microservices with FaaS today – esp. for greenfield, if the granularity fits § Today limits like programming model lock-in, cold starts § Serverless Azure offers various 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 Event-getriebene Microservices mit Azure Functions und Co. – auch für Java-Entwickler Serverless-Architekturen Summary