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

Pragmatische Microservices-Architekturen mit AS...

Pragmatische Microservices-Architekturen mit ASP.NET Core & 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/.NET-Core-Welt? Sehen Sie Architekturansätze in Aktion und erleben Sie Technologien wie Service Discovery, Web API, SignalR, Message Queuing und Azure im praktischen Einsatz. Versuchen wir also gemeinsam, langweilige Architekturthemen spannend zu machen: auf pragmatische Weise!

Christian Weyer

September 25, 2018
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. § 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 Christian Weyer mit ASP.NET Core Web APIs, SignalR & Co. Pragmatische Microservices-Architekturen 2
  2. § Functional focus § API-fication – everywhere, for everyone §

    APIs & services may be in place, but often monoliths § Simpler development & deployment § End-to-End functionality - including UIs Why? Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & 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 ASP.NET Core Web APIs, SignalR & Co. 8
  4. § Single Responsibility § Focused around business domain § ‘Small’

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

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

    SignalR & Co. 11 HTTP API WS API Service D HTTPS HTTPS WebSocket Service A Service B Service C HTTP API
  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 ASP.NET Core Web APIs, SignalR & 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 ASP.NET Core Web APIs, SignalR & Co. Describing Web APIs 14
  9. § Consumers need to find services § Services should register

    themselves and be discoverable § Infrastructure should monitor service availability § Simple discovery: Plain DNS works in a lot of cases § Enhanced discovery with attached metadata sometimes needed, e.g. with Consul § Consul § Consul.NET Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & 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 ASP.NET Core Web APIs, SignalR & 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 ASP.NET Core Web APIs, SignalR & 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 ASP.NET Core Web APIs, SignalR & Co. Push Communication 18
  13. § Keep the release cycles short § Keep setup efforts

    & dependencies under control § DevOps, FTW! § Container-ize your solution § Make it available & scalable with an orchestrator § Make sure you see everything from your solution § Tracing, Logging & Monitoring § Docker § Kubernetes Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. Developing, Deploying, Running 19
  14. § Domain-Driven Design § Testing § Validation § Versioning §

    Deployment § Scalability § Availability § … and so on ... There is much, much more to consider! Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 20
  15. User Interfaces mit ASP.NET Core Web APIs, SignalR & Co.

    Pragmatische Microservices-Architekturen 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 (Iframes, Web Components) § Open-sourced real world PoC with SPA & server-side solutions § http://lvm-it.github.io/ Microservices can have UIs: Microfrontends mit ASP.NET Core Web APIs, SignalR & Co. Pragmatische Microservices-Architekturen 22
  17. § Those are just some approaches & patterns – not

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

    architectures – sadly KISS ! Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 25 !
  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: AKS, Service Fabric, Functions § Microservices bring their own – partly new – challenges: be prepared! § Always stay cool: Keep it simple & stupid! ! Summary Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 26