Slide 1

Slide 1 text

Pragmatische Microservices mit .NET Core (3) – mehr als nur gRPC Christian Weyer @christianweyer CTO @ Thinktecture AG

Slide 2

Slide 2 text

The image part with relationship ID rId4 was not found in the file. The image part with relationship ID rId4 was not found in the file. The image part with relationship ID rId4 was not found in the file. Special Day “Modern Business Applications” Thema Sprecher Datum, Uhrzeit Raum Pragmatische Microservices mit .NET Core 3 – mehr als nur gRPC Christian Weyer DI, 25. Februar 2020, 10.30 bis 11.30 Ballsaal 2 Web Components: native Komponenten fürs Web – das Ende der SPA Frameworks? Manuel Rauber DI, 25. Februar 2020, 11.45 bis 12.45 Ballsaal 2 Progressive Web Apps – die Grundlagen Sebastian Springer DI, 25. Februar 2020, 14.15 bis 15.15 Ballsaal 2 Progressive Web-Apps mit Angular: Tipps für Fortgeschrittene Christian Liebel DI, 25. Februar 2020, 15.30 bis 16.30 Ballsaal 2 Blazor: SPAs im Browser mit C# und WebAssembly Christian Weyer DI, 25. Februar 2020, 17.15 bis 18.15 Ballsaal 2

Slide 3

Slide 3 text

Pragmatische Microservices mit .NET Core – mehr als nur gRPC Boooring!!! https://twitter.com/funcOfJoe/status/1110754437834764288 3

Slide 4

Slide 4 text

§ Co-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 Developer Technologies & Azure ASPInsider, AzureInsider § Google GDE for Web Technologies, Angular [email protected] @christianweyer https://www.thinktecture.com Christian Weyer mit .NET Core – mehr als nur gRPC Pragmatische Microservices 4

Slide 5

Slide 5 text

§ Microservices - demystified § Typical Microservices patterns § Microservices implemented with plain .NET Core § Being pragmatic Topics Pragmatische Microservices mit .NET Core – mehr als nur gRPC 5

Slide 6

Slide 6 text

Microservices demystified Pragmatische Microservices mit .NET Core – mehr als nur gRPC 6

Slide 7

Slide 7 text

Pragmatische Microservices mit .NET Core – mehr als nur gRPC 7

Slide 8

Slide 8 text

Pragmatische Microservices mit .NET Core – mehr als nur gRPC Microservices, FTW! 8 https://twitter.com/ryan_marsh/status/980217902740762624

Slide 9

Slide 9 text

Pragmatische Microservices mit .NET Core – mehr als nur gRPC 9

Slide 10

Slide 10 text

Pragmatische Microservices mit .NET Core – mehr als nur gRPC 10

Slide 11

Slide 11 text

§ Docker § Kubernetes § Azure § Serverless § Git § NoSQL § Node.js § Service Fabric § gRPC § No more than 20 lines of code in deployed service Microservices are not… Pragmatische Microservices mit .NET Core – mehr als nur gRPC 11

Slide 12

Slide 12 text

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 mit .NET Core – mehr als nur gRPC (Some) Principles of Microservices 12

Slide 13

Slide 13 text

Microservices Approaches & Patterns Implemented with plain .NET Core Pragmatische Microservices mit .NET Core – mehr als nur gRPC 13

Slide 14

Slide 14 text

Bird’s-Eye-View Target Architecture Pragmatische Microservices mit .NET Core – mehr als nur gRPC 14 HTTP API WS API Service D HTTPS HTTPS WebSocket Service A Service B Service C HTTP API

Slide 15

Slide 15 text

Simple Sample J Pragmatische Microservices mit .NET Core – mehr als nur gRPC 15

Slide 16

Slide 16 text

Pragmatische Microservices mit .NET Core – mehr als nur gRPC Sample Architecture – Shopping Order Monitoring Orders Service Shipping Service AuthN Service Order Monitoring SPA Shopping Web Site (simulated by Postman) 1 - authenticate 2 - register for push 3 - send new order 5 - new order created push 6 - get updated orders 4 - processing order… 16

Slide 17

Slide 17 text

§ Inbound HTTP / Web APIs § HTTPS, JSON, Binary § Different API Styles § RPC § OData § GraphQL § „REST“ § gRPC § Outbound communication § Web Sockets § Web Hooks § ASP.NET Core MVC § ASP.NET Core SignalR Pragmatische Microservices mit .NET Core – mehr als nur gRPC Open & Interoperable Interfaces 17

Slide 18

Slide 18 text

§ Open source remote procedure call (RPC) system initially developed at Google in 2015 § HTTP/2 for transport § Protocol Buffers as interface description language § Features like § Bidirectional streaming § Flow control Pragmatische Microservices mit .NET Core – mehr als nur gRPC gRPC 18 § When to use gRPC – when Web APIs (REST)? § gRPC uses more compact data format → may be relevant for runtime performance § gRPC offers contracts and enables contract-first via ProtoBuf § Web APIs can do the same via Swagger / Open API § Web APIs should be used in open user-facing frontends § Wide interoperability and network compatibility § gRPC does not work in Azure Web Apps § Grpc.AspNetCore (>= .NET Core 3)

Slide 19

Slide 19 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.AspNetCore Pragmatische Microservices mit .NET Core – mehr als nur gRPC Describing Web APIs 19

Slide 20

Slide 20 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 mit .NET Core – mehr als nur gRPC Registry, Discovery & Monitoring 20

Slide 21

Slide 21 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 mit .NET Core – mehr als nur gRPC Security 21

Slide 22

Slide 22 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 1.0 § RabbitMQ latest version § Apache ActiveMQ § Be resilient when communicating § RabbitMQ § EasyNetQ § ActiveMQ § Amqp.Net Lite § Azure Service Bus § Polly.NET Pragmatische Microservices mit .NET Core – mehr als nur gRPC Messaging & Queuing 22 X P S S

Slide 23

Slide 23 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 (including Web Push) § Application push § Web Sockets § ASP.NET Core SignalR Pragmatische Microservices mit .NET Core – mehr als nur gRPC Push Communication 23

Slide 24

Slide 24 text

§ Keep the release cycles short § Keep setup efforts & dependencies under control § DevOps, really § Container-ize your solution § Optional: make it available & scalable with an orchestrator § Or put it in a managed env § Make sure you see everything from your solution § Tracing, Logging & Monitoring § Docker § Kubernetes § Serilog § Seq Pragmatische Microservices mit .NET Core – mehr als nur gRPC Developing, Deploying, Running 24

Slide 25

Slide 25 text

§ Domain-Driven Design § Testing § Validation § Versioning § Deployment § Scalability § Availability § … and so on ... There is much, much more to consider! Pragmatische Microservices mit .NET Core – mehr als nur gRPC 25

Slide 26

Slide 26 text

Being Pragmatic Pragmatische Microservices mit .NET Core – mehr als nur gRPC 26

Slide 27

Slide 27 text

§ Those are just some approaches & patterns – not rules § Pick and choose wisely § E.g. How would you deal with Offline-first in Microservices world? § There are not a lot of Netflix, Facebooks, Twitters etc. out there § Take a first step: modular monoliths § Slice your application in modules, with interfaces § Use these modules (DLLs) with a functional services mindset § If you can’t build monoliths properly, you will fail with Microservices For You: Pragmatic == Requirements- & Use-Case-driven Pragmatische Microservices mit .NET Core – mehr als nur gRPC 27

Slide 28

Slide 28 text

§ From 23 years of consulting experience: A lot of projects fail because of… overly complex architectures – sadly § Do not over-complicate KISS (Keep it simple and stupid) Pragmatische Microservices mit .NET Core – mehr als nur gRPC 28

Slide 29

Slide 29 text

Recap Pragmatische Microservices mit .NET Core – mehr als nur gRPC 29

Slide 30

Slide 30 text

Recap Pragmatische Microservices mit .NET Core – mehr als nur gRPC 30 Technologies are micro decisions – E.g. gRPC or Docker are details Don’t be led by frameworks & techs – be led by requirements Microservices are an overall approach – including your org Decoupling is great – but may increase complexity Clients are important – Microfrontends bring their own problems Start with modular monoliths - can’t build monoliths properly → fail with Microservices

Slide 31

Slide 31 text

Danke! Bei Fragen kontaktieren Sie mich gerne Christian Weyer https://thinktecture.com/christian-weyer @christianweyer [email protected] Demo: https://github.com/thinktecture/pragmatic-microservices-dotnetcore Artikel zu Blazor, PWA, Web Components, Angular, .NET Core & mehr: https://thinktecture.com/de/newsletter 31