Slide 1

Slide 1 text

Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. Christian Weyer @christianweyer CTO

Slide 2

Slide 2 text

§ 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

Slide 3

Slide 3 text

Motivation Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 3

Slide 4

Slide 4 text

§ 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

Slide 5

Slide 5 text

Microservices demystified Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 5

Slide 6

Slide 6 text

Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 6

Slide 7

Slide 7 text

Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 7

Slide 8

Slide 8 text

§ 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

Slide 9

Slide 9 text

§ 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

Slide 10

Slide 10 text

Microservices Approaches & Patterns Implemented with plain .NET / .NET Core Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 10

Slide 11

Slide 11 text

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

Slide 12

Slide 12 text

Simple Sample J Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 12

Slide 13

Slide 13 text

§ 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

Slide 14

Slide 14 text

§ 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

Slide 15

Slide 15 text

§ 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

Slide 16

Slide 16 text

§ 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

Slide 17

Slide 17 text

§ 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

Slide 18

Slide 18 text

§ 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

Slide 19

Slide 19 text

§ 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

Slide 20

Slide 20 text

§ 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

Slide 21

Slide 21 text

User Interfaces mit ASP.NET Core Web APIs, SignalR & Co. Pragmatische Microservices-Architekturen 21

Slide 22

Slide 22 text

§ 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

Slide 23

Slide 23 text

Being Pragmatic Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 23

Slide 24

Slide 24 text

§ 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

Slide 25

Slide 25 text

§ A lot of projects fail because of… overly complex architectures – sadly KISS ! Pragmatische Microservices-Architekturen mit ASP.NET Core Web APIs, SignalR & Co. 25 !

Slide 26

Slide 26 text

§ 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