Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Pragmatische Microservices-Architekturen mit .N...

Pragmatische Microservices-Architekturen mit .NET Core – Patterns & Code

Angetrieben durch mögliche Nachteile einer monolithischen Architektur wollen Microservices und damit verbundene Designpatterns und -ideen das scheinbare Allheilmittel sein. In diesem Vortrag klärt Christian Weyer die folgenden Fragen: Was sind Microservices und was sind sie nicht? Wann setzt man sie ein? Und vor allem: Wie baut und betreibt man Microservices in der .NET-Core-Welt? Sehen Sie Architekturansätze und Patterns in Aktion und erleben Sie Technologien wie Service Discovery, Web APIs, SignalR, Message Queuing und Co. im praktischen Einsatz. Versuchen wir also gemeinsam, langweilige Architekturthemen spannend zu machen: auf pragmatische Weise. Dieser Talk richtet sich an .NET-Entwickler- und -Architekten, die Microservices verstehen und ohne jegliche Frameworks und Clouds in Aktion sehen wollen.

Christian Weyer

February 26, 2019
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 https://www.thinktecture.com Christian Weyer mit .NET Core - Patterns & Code Pragmatische Microservices-Architekturen 2
  2. § Microservices - demystified § Typical Microservices patterns § Microservices

    implemented with plain .NET Core § Being pragmatic Topics Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 3
  3. Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code Microservices,

    FTW! 6 https://twitter.com/ryan_marsh/status/980217902740762624
  4. § 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… https://lostechies.com/jimmybogard/2016/06/03/what-microservices-is-not/ Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 8
  5. Single Responsibility § Focused around business domain § ‘Small’ Isolation

    § Choice of technology § Well-defined technology- agnostic API § Mobility Autonomy § Exclusive state (data storage) Decoupling § Asynchronous communication § Really, always? Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code (Some) Principles of Microservices 9
  6. Microservices Approaches & Patterns Implemented with plain .NET / .NET

    Core Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 10
  7. Bird’s-Eye-View Target Architecture Pragmatische Microservices-Architekturen mit .NET Core - Patterns

    & Code 11 HTTP API WS API Service D HTTPS HTTPS WebSocket Service A Service B Service C HTTP API
  8. § 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 Core - Patterns & Code Open & Interoperable Interfaces 13
  9. § 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 Core - Patterns & Code Describing Web APIs 14
  10. § 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 .NET Core - Patterns & Code Registry, Discovery & Monitoring 15
  11. § 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 Core - Patterns & Code Security 16
  12. § Asynchronous message passing for decoupling § Different message exchange

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

    important changed § Near real-time push from services § Platform push § Provided by platform vendors (including Web Push) § Application push § Web Sockets § ASP.NET SignalR § ASP.NET Core SignalR Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code Push Communication 18
  14. § 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 § Serilog § Seq Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code Developing, Deploying, Running 19
  15. § Domain-Driven Design § Testing § Validation § Versioning §

    Deployment § Scalability § Availability § … and so on ... There is much, much more to consider! Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 20
  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 .NET Core - Patterns & Code 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! § Take a first step: modular monoliths § Slice your application in modules § If you can’t build monoliths properly, you will fail with Microservices ! Pragmatic == Requirements- & Use-Case-driven Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 24
  18. § BTW: A lot of projects fail because of… overly

    complex architectures – sadly KISS ! Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 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, Serverless § Microservices bring their own – partly new – challenges: be prepared! § Always stay cool: Keep it simple & stupid! ! Summary Pragmatische Microservices-Architekturen mit .NET Core - Patterns & Code 26