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

Serverless-Architekturen: Event-basierte Micros...

Serverless-Architekturen: Event-basierte Microservices mit Azure & .NET Core

Sie planen die nächste Generation Ihrer Business-Software? Dann schauen Sie sicherlich in Richtung Microservices für Ihre Enterprise- oder Software-as-a-Service-Lösung. Das ist gut. Und Sie liebäugeln mit Container-Tools wie Docker und Container-Orchestrators wie Kubernetes? Hm. Eventuell sollten Sie einen Schritt weitergehen und sich mit dem Serverless-Ansatz beschäftigen. Er verspricht eine niedrigere Hürde, um den Einstieg zu finden und auch um ans Ziel zu kommen. Dabei ist Serverless jedoch nicht für jeden und alles geeignet. In diesem Workshop zeigt Christian Weyer die Grundlagen von Serverless mit Azure und .NET Core anhand eines realistischen Anwendungsbeispiels aus dem Kundenprojektumfeld. Auf Basis erprobter Design Patterns können Sie mit Azure Functions, Azure Event Grid, Azure Cosmos DB, Azure Storage & Co. in kurzer Zeit einfache & komplexe Anwendungen designen und implementieren. Einer der Schlüssel ist hierbei das Denken in Events, über die Daten übertragen, verarbeitet und weitergeleitet werden. Sie können lokal entwickeln, testen & betreiben und anschließend auf Wunsch in der Azure Cloud kostenoptimiert, hochskalierend und optional global verfügbar Ihre Services deployen. Ohne dass Sie dabei zu viele Details des Betriebs übernehmen müssen – Serverless eben 🙂 Doch ist Serverless mit Azure wirklich so gut wie sich das alles anhört? Kommen Sie in diesen Workshop und bilden Sie sich Ihre Meinung – eventuell lernen Sie die Basis Ihrer neuen Business-Software hier kennen.

Christian Weyer

April 26, 2018
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. 2 § Co-founder, co-owner and CTO at Thinktecture AG §

    Focus on § Mobile & web-based application architectures § Interoperability, cross-device § Pragmatic end-to-end solutions § Cloud-native architectures § Microsoft MVP for ASP.NET (Architecture) ASPInsider, AzureInsider § Google GDE for Web Technologies § [email protected] § ! @christianweyer Christian Weyer Serverless-Architekturen Event-basierte Microservices mit Azure & .NET / .NET Core
  2. 3 § Microservices & Event-driven Integration § End-to-end Scenarios &

    Architectures § Azure Cloud § Serverless in Azure § Azure Functions § Azure Cosmos DB § Azure Event Grid § And more… § Summary Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Topics
  3. 5 § Build & provide software systems easily & quickly

    § Need of integrating systems, applications, services, data § EAI: Enterprise Application Integration § B2B: Business-to-Business communication § B2C: Business-to-Consumer communication § Possible approaches & patterns § Microservices, Nanoservices, Picoservices – WTF? § Free choice of technical platform & framework § Event-driven integration § Can the Cloud offer value here? § Without having to always worry about too many (unnecessary) details… Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Building & integrating modern software systems
  4. 6 § Single responsibility § Focused around business domain §

    Small, doing one thing § Autonomy § Exclusive State § Can live on its own § Easier to CI /CD § Isolation § Well-defined technology-agnostic API § Mobility § Asynchronous communication for integration § Decoupled message passing, e.g. publish & subscribe Principles of Microservices Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen
  5. 8 § Why Azure? § Look beyond one’s own nose

    § Microsoft has always been strong in the enterprise § It is no longer “Windows Azure” J § Ca. 40% of VMs running on Linux (increasing) § Strong developer tooling § Very broad availability worldwide § German Azure as sovereign Cloud Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Azure Cloud https://www.cnbc.com/2017/10/28/microsoft-azure-is-growing-faster-than-aws-backed-by-big-brands.html
  6. 11 Event-basierte Microservices mit Azure & .NET / .NET Core

    Serverless-Architekturen End-to-End Target Architecture HTTP HTTPS WebSocket Service A Service B Service C Web APIs (ASP.NET, Node.js, …) HTML5-Application (Single-Page Application) Web Cordova Electron
  7. 13 § We can choose from a continuum § VM

    ➔ § Containers ➔ § Orchestrators ➔ § PaaS ➔ § Serverless Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Evolution to Cloud Compute Continuum PaaS IaaS On-Premises Serverless
  8. 15 § Serverless Compute → Azure Functions § Serverless Database

    → Azure Cosmos DB § Serverless Events → Azure Event Grid § Serverless Workflows → Azure Logic Apps Azure Durable Functions § Serverless IoT → Azure IoT Hub § Serverless Analytics → Azure Application Insights § Serverless Containers → Azure Container Instances § ... and more ... https://azure.microsoft.com/en-us/overview/serverless-computing/ Serverless-Architekturen Serverless in Azure (Serverless != FaaS-only) Event-basierte Microservices mit Azure & .NET / .NET Core
  9. 17 § Azure Functions is code being triggered by an

    event § Focused code + events § Basic principles enable powerful use cases § Events § Triggers § Bindings § Two ways of operation § Cost-optimized, automatic scale (aka Consumption Plan) § Always-on, via Azure App Service § V2 Runtime built on .NET Core § Available for self-hosting Serverless-Architekturen Azure Functions: Functions-as-a-Service Event-basierte Microservices mit Azure & .NET / .NET Core
  10. 18 § Cold vs. warm start Event-basierte Microservices mit Azure

    & .NET / .NET Core Serverless-Architekturen Azure Functions: Activation in Consumption Plan https://blogs.msdn.microsoft.com/appserviceteam/2018/02/07/understanding-serverless-cold-start/
  11. 19 § In portal, via CLI, or in IDE §

    Visual Studio wizards for pre-compiled Functions § Local tooling & runtime available § Debugging locally or remote § Multiple language bindings supported § C# & C# Script (CSX) § F# § JavaScript, TypeScript (node.js) § Python § Php § Java (preview) § Bash, Batch, PowerShell Serverless-Architekturen Developing Functions Event-basierte Microservices mit Azure & .NET / .NET Core
  12. 20 § Incoming event triggers function § Input bindings enable

    easy access to data from various data sources § Output bindings offer easy access to outbound data sinks § Custom triggers and bindings can be implemented Serverless-Architekturen Triggers & Bindings Event-basierte Microservices mit Azure & .NET / .NET Core https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings
  13. 21 Serverless-Architekturen Functions Illustrated - Exemplary Your code logic Runtime

    Azure Function HTTP Trigger Custom Event Input Binding Storage Input Binding Push Notification Output Binding Database Output Binding Email Output Binding Event-basierte Microservices mit Azure & .NET / .NET Core
  14. 23 § Azure Portal § Azure CLI / PowerShell §

    Visual Studio wizards § Container (v2) § Continuous integration § Git § GitHub § Bitbucket § VSTS § DropBox, OneDrive Serverless-Architekturen Deployment Options Event-basierte Microservices mit Azure & .NET / .NET Core
  15. § PaaS / AaaS § Identity Server § Functions §

    HTTP-triggered § Database-triggered § Triggered through IoT data § Event-triggered (system event) § Database § Subscribing to collection changes § IoT § Secure device connectivity & communication § Events § Publishing custom application- specific events § Workflow § Programmatically create stateful workflows Serverless-Architekturen Demo Scenario: Home Automation with Serverless (extracted from customer project scenarios) Event-basierte Microservices mit Azure & .NET / .NET Core 25
  16. 28 § Globally distributed, elastically scalable § Fully managed by

    Azure § Multi-model database § Key-value, document, graph § Multiple APIs § DocumentDB, with SQL & JS APIs § MongoDB API § Cassandra API § Table Storage API § Graph Database with Gremlin API § No database schema management Serverless-Architekturen Cosmos DB: A Database with Many Faces Event-basierte Microservices mit Azure & .NET / .NET Core
  17. 29 § Building event-driven architectures with Cosmos DB § Use

    as input binding in Functions § Subscribe to collection changes § Can be used as a trigger for Functions Serverless-Architekturen Cosmos DB Change Feed Event-basierte Microservices mit Azure & .NET / .NET Core
  18. 31 § Fully-managed centralized event routing service § Simplifies development

    of event-based applications § Simplifies creation of serverless workflows § Manages all routing of events § From any source, to any destination, for any application § Eventing, not enterprise messaging § Supports direct event filtering using event type, prefix or suffix § Your application will only need to receive the events you care about § Same underlying model for different use-cases § System-provided events § Custom application-specific events Serverless-Architekturen Event Grid Event-basierte Microservices mit Azure & .NET / .NET Core
  19. 34 § Durable Functions (DF) let developers abstract away management

    of state for complex, stateful orchestrations § In code, not markup § Can be started via orchestration client § Via HTTP addressable state machine § Mental model: “Serverless orchestrations” § Based on Durable Task Framework § Write long running persistent workflows in C# using async/await § https://github.com/Azure/durabletask § Some say “WF done better” Azure Durable Functions Serverless-Architekturen Event-basierte Microservices mit Azure & .NET / .NET Core
  20. 35 § Extension of Azure Functions § Manages state, checkpoints,

    and restarts for you § You have to play by the rules § Define stateful workflows in a new type of function called orchestrator function § Advantages of orchestrator functions: § Define workflows in code § Call other functions synchronously and asynchronously § Output from called functions can be saved to local variables § Automatically checkpoint progress whenever the function awaits § Local state is never lost if the process recycles or the underlying VM reboots § Orchestrators can call activity functions, other sub-orchestrations, and wait for an external event Azure Durable Functions Serverless-Architekturen Event-basierte Microservices mit Azure & .NET / .NET Core
  21. 36 Event-basierte Microservices mit Azure & .NET / .NET Core

    Serverless-Architekturen Azure Durable Functions - Patterns § Function chaining § Fan-out / fan-in § Async HTTP APIs § Stateful singletons § Human interaction
  22. 38 § Basic Idea: bring serverless functionality to non-coders §

    Low-code, No-code § No-code: ‘citizen developers’ / business users who can build functional but generally limited apps without having to write a line of code § Low-code: professional developers, streamlining and simplifying their work – delivering enterprise-class applications with little or no hand-coding § Graphical designer for rapid creation § With underlying descriptive model § Azure Logic Apps offer integration and workflow offering in the Cloud § Low-code / no-code § IFTTT for businesses Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Codeless Workflows
  23. 39 § A Logic App workflow § Begins with a

    trigger (like 'When an account is added to Office 365') § After trigger many combinations of § Actions § Conversions § Condition logic § Cloud-ready features § Custom retry policy § No need to code any retry, Azure Logic App will handle this § Managed scale § Azure will scale out your workflow runs with the resource it needs Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Azure Logic Apps
  24. 40 Event-basierte Microservices mit Azure & .NET / .NET Core

    Serverless-Architekturen Visual Designer in Browser
  25. 41 • AppFigures • Asana • Azure API Management •

    Azure App Services • Azure Automation • Azure Cognitive Face API • Azure Cognitive LUIS • Azure Cognitive Text Analytics • Azure Cognitive Vision • Azure Data Lake Store • Azure Document DB • Azure Event Hub • Azure Functions • Azure Machine Learning • Azure Resource Manager • Azure Service Bus • Azure SQL • Azure Storage Blob • Azure Storage Queues • Basecamp • Bing Search • BitBucket • Bitly • Blogger • Box • Buffer • Campfire • Chatter • Common Data Service • Disqus • DocuSign • Dropbox • Dynamics AX Online • Dynamics CRM Online • Dynamics CRM Service Bus • Dynamics Financials • Dynamics Operations • Easy Redmine • Eventbrite • Facebook • FreshBooks • Freshdesk • GitHub • Gmail • Google Calendar • Google Contacts • Google Drive • Google Sheets • Google Tasks • GoTo Meeting • GoTo Training • GoTo Webinar • Harvest • HelloSign • Infusionsoft • JIRA • Insightly • Instagram • Instapaper • MailChimp • Mandrill • Medium • Microsoft Project Online • Microsoft Translator • MSN Weather • Muhimbi PDF • Office 365 • Office 365 Users • Office 365 Video • OneDrive • OneDrive for Business • OneNote • Outlook.com • Outlook Tasks • PagerDuty • Pinterest • Pipedrive • Pivotal Tracker • Power BI • Project Online • Redmine • Salesforce • Salesforce Chatter • SendGrid • SharePoint Online • Slack • SmartSheet • SparkPost • Stripe • Survey Monkey • Todoist • Toodledo • Trello • Twilio • Twitter • Typeform • UserVoice • VS Team Services • Webmerge • Wordpress • Wunderlist • Yammer • YouTube • Zendesk • HTTP, HTTPS • HTTP Webhook • FTP, SFTP • SMTP • RSS • Compose, Query, Parse JSON • Wait • Terminate • Workflow Protocols/Native • XML Validation • Transform XML (+Mapper) • Flat File Encode • Flat File Decode • X12 • EDIFACT • AS2 • Integration Account Artifact Lookup XML and EDI Hybrid • BizTalk Server • File System • IBM DB2 • Informix • Oracle DB • SharePoint Server • SQL Server • SAP • Websphere MQ SaaS Logic Apps Connectivity Serverless-Architekturen Event-basierte Microservices mit Azure & .NET / .NET Core
  26. 43 IoT & the Azure Cloud Serverless-Architekturen Event-basierte Microservices mit

    Azure & .NET / .NET Core https://4.bp.blogspot.com/-SQHr_XnFfUM/VBjq1wFkmUI/AAAAAAAAAyE/coSUQ71f1k8/s1600/20140912_231941.jpg
  27. 44 § Bi-directional communication with IoT devices § IoT device

    management § Supports MQTT § Lightweight § Publish/Subscribe § Secure § Lots of SDKs available § C § Java § .NET § Node.js § Python Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Azure IoT Hub
  28. 46 § Serverless is just one option in the Cloud

    Continuum § Always think about the use cases and requirements § Serverless Azure tries to offer solutions in the Continuum – mixture of PaaS & FaaS § Functions § Cosmos DB § Event Grid § … & more § It is not about Windows & .NET / .NET Core - it is about any OS, any platform, any language – any solution J § Azure Germany: a sovereign Cloud, not operated by Microsoft, on German soil Summary Serverless-Architekturen Event-basierte Microservices mit Azure & .NET / .NET Core
  29. 47 § Processing 100,000 Events Per Second on Azure Functions

    § https://blogs.msdn.microsoft.com/appserviceteam/2017/09/19/processing- 100000-events-per-second-on-azure-functions/ § Azure Functions – Significant Improvements in HTTP Trigger Scaling § https://www.azurefromthetrenches.com/azure-functions-significant- improvements-in-http-trigger-scaling/ § Azure Functions: Cold Starts in Numbers § https://mikhail.io/2018/04/azure-functions-cold-starts-in-numbers/ Event-basierte Microservices mit Azure & .NET / .NET Core Serverless-Architekturen Interesting reading
  30. 48 § OK – you asked for it J §

    https://docs.microsoft.com/en-us/azure/architecture/aws- professional/services § Microsofts „Azure & AWS Cloud Service Map“ § https://aka.ms/awsazureguide AWS & Azure Serverless-Architekturen Event-basierte Microservices mit Azure & .NET / .NET Core
  31. Serverless-Architekturen: Event-basierte Microservices mit Azure & .NET / .NET Core

    Christian Weyer @christianweyer [email protected] Thank you! https://github.com/thinktecture/dotnet-summit-spring-2018-serverless-azure