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

Pragmatische Microservices-Architekturen mit .N...

Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co.

Das Schlagwort „Microservices“ ist in aller Munde. Angetrieben durch die zahlreichen Nachteile einer monolithischen Architektur wollen Microservices und damit verbundene Design Patterns und -Ideen das scheinbare Allheilmittel sein. In diesem Vortrag klärt Christian Weyer über den Mythos Microservices auf. Was sind sie, was sind sie nicht, wann setzt man sie ein – und vor allem: Wie baut und betreibt man Microservices in der .NET-Welt? Sehen Sie Architekturansätze in Aktion und erleben Sie Technologien wie Discovery, Web API, SignalR, Containers und Co. im praktischen Einsatz. Versuchen wir also gemeinsam, auf pragmatische Weise langweilige Architekturthemen ein bisschen spannend zu machen.

Christian Weyer

September 26, 2017
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. § Co-founder, co-owner & 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 Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 2
  2. § API-fication – everywhere, for everyone § Services may be

    in place, but often monoliths § Simpler development & deployment § End-to-End functionality - including UIs Why? Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 4
  3. § Docker / containers § Azure / AWS § Serverless

    § Feature flags § Gitflow § NoSQL § Node.js § No more than 20 lines of code in deployed service § AWS Lambda § Service Fabric Microservices are not just… https://lostechies.com/jimmybogard/2016/06/03/what-microservices-is-not/ Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 8
  4. § Single Responsibility § Focused around business domain § Small

    § Autonomy § Exclusive State § Isolation § Well-defined technology-agnostic API § Mobility § Asynchronous Communication § Decoupled message passing § Really, always? Principles of Microservices Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 9
  5. Microservices Approaches & Patterns Implemented with plain .NET / .NET

    Core Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 10
  6. Bird’s-Eye-View Target Architecture Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR

    und Co. 11 HTTP HTTPS WebSocket Service A Service B Service C Web APIs (ASP.NET, Node.js, …) HTML5-Application (Single-Page Application) Web Cordova Electron
  7. § Inbound HTTP / Web APIs § HTTPS, JSON, Binary

    § Different API Styles § RPC § OData § GraphQL § „REST“ § Outbound communication § Web Sockets § Web Hooks § ASP.NET Web API § ASP.NET Core MVC § ASP.NET SignalR § ASP.NET Core SignalR § ASP.NET WebHooks Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Open & Interoperable Interfaces 13
  8. § If you are not a hardcore REST-afarian you may

    want to have your interfaces described / documented § Technical for further tooling § Human readable § E.g. Swagger / OpenAPI § Swashbuckle § Swashbuckle.AspNetCore Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Describing Web APIs 14
  9. § Consumers need to find services § Services should register

    themselves and be discoverable § Infrastructure should monitor service availability § E.g. with DNS or Consul § Consul § Consul.NET Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Registry, Discovery & Monitoring 15
  10. § Microservices need to be secured § Think about trusted

    subsystems where possible § Need to authenticate applications and users § Separate authentication into its own microservice § Apply authorization logic in the functional microservices § Standards help § OAuth2 & OpenID Connect § IdentityServer § Azure Active Directory § Azure Active Directory B2C Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Security 16
  11. § Asynchronous message passing for decoupling § Different message exchange

    patterns at your hand § RabbitMQ as popular broker- based system § But standards help: think about AMQP § E.g. Apache ActiveMQ § Be resilient when communicating § RabbitMQ § EasyNetQ § ActiveMQ § Amqp.Net Lite § Azure Service Bus § Polly.NET Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Messaging & Queuing 17 X P S S
  12. § Always think end-to-end § Let consumers know that something

    important changed § Near real-time push from services § Platform push § Provided by platform vendors § Application push § Web Sockets § ASP.NET SignalR § ASP.NET Core SignalR Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Push Communication 18
  13. § Keep the release cycles short § Keep setup efforts

    & dependencies under control § DevOps, FTW! § Container-ize your solution § With an orchestrator § Make sure you see everything from your solution § Tracing, Logging & Monitoring § Docker § Kubernetes Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. Developing, Deploying, Running 19
  14. § We can use containers and move them to Azure

    with Azure Container Services & Registry § If we want orchestrateable environments to run everywhere § Symmetric experience on-prem & in Cloud § We can use an optimized Cloud-OS as base – i.e. Azure Service Fabric § If we need very high scale in our own base architectural artefacts § Symmetric experience on-prem & in Cloud § We can use Cloud-native approaches like App Services or Functions § If we do not care about servers, virtual machines, containers and all that § Symmetric experience on-prem & in Cloud § In any way: there are many options – and no ‚that one solution‘ § “It depends…“ J Moving to the Cloud – Azure to the rescue Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 20
  15. § Domain Design § Testing § Validation § Versioning §

    Deployment § Scalability § Availability § … and so on ... There is much, much more to consider! Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 21
  16. § When thinking end-to-end, there are microservices with and without

    user interfaces § Need a way to compose UIs consisting of several „sub-UIs“ § Can be done server-side § Can be done client-side, SPA-style § Open-sourced real world sample with SPA & server-side solutions § http://lvm-it.github.io/ Microservices can have UIs: Micro frontends mit .NET, Web APIs, SignalR und Co. Pragmatische Microservices-Architekturen 23
  17. § Those are just some approaches & patterns – not

    rules § Pick and choose wisely § There are not a lot of Netflix, Facebooks, Twitters out there § Do not over-complicate! Pragmatic == Requirements- & Use-Case-driven Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 25
  18. § A lot of projects fail because of… overly complex

    architectures – sadly KISS ! Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 26
  19. § Microservices are all the hype § A lot of

    the ideas are not really new – “SOA done right” § Focus on the (a) business domain § New approaches & tooling for shorter dev & release cycles bring value-add § Many ways to approach microservices in the .NET world § Plain, as seen here § Using some framework § Using all-the-things Azure: Cloud OS, Containers, Serverless § Microservices bring their own – partly new – challenges – be prepared § Always stay cool: Keep it simple & stupid! Summary Pragmatische Microservices-Architekturen mit .NET, Web APIs, SignalR und Co. 27