$30 off During Our Annual Pro Sale. View Details »

Right {thing, focus, place}: Cloud-native micro...

Right {thing, focus, place}: Cloud-native microservices – with Dapr?

Microservices-all-the-things. Yeah, we heard you. Today, let's talk about pragmatic ways of implementing service-based architectures, satisfying modern cloud-native approaches. Doing the right thing. With exemplary use of the open-source Dapr runtime and framework, Christian shows how to concentrate your time and brainpower on writing features & business logic, not infrastructure. Keeping the right focus. Last but not least, he discusses how to run your [micro]services on a spectrum of execution environments, from self-hosted on-premises to the public cloud. Picking the right place.

Christian Weyer

May 25, 2022
Tweet

More Decks by Christian Weyer

Other Decks in Programming

Transcript

  1. Cloud-na)ve microservices – with Dapr? Right {thing, focus, place} Chris&an

    Weyer @christianweyer Thinktecture AG, Co-Founder & CTO
  2. § Co-Founder & CTO at Thinktecture AG § Personal focus

    on § Cloud-native & serverless architectures § Pragmatic end-to-end solutions § Mobile & web-based application architectures § Independent Microsoft Regional Director § Microsoft MVP for Developer Technologies & Azure ASPInsider, AzureInsider § Google GDE for Web Technologies [email protected] @christianweyer https://www.thinktecture.com Christian Weyer Cloud-native microservices - with Dapr? Right {thing, focus, place} 2
  3. § Docker § Kubernetes § Azure § Serverless § NoSQL

    § Service Fabric § Dapr § gRPC § … no more than 20 lines of code per service … § … further BS … Microservices do not mean… Right {thing, focus, place} Cloud-native microservices - with Dapr? 9
  4. § … implement domain boundaries based on business capabilities &

    data § This is not a technical thing § This is a very hard job to do right § No programming language or framework helps here § … are subject to & influence organization structure (teams etc.) § Conway’s law § … are just one style of architecture § We can mix and match § We can – and should! - be pragmatic to chose Right {thing, focus, place} Cloud-native microservices - with Dapr? Microservices … 10
  5. § Let’s not talk about Microservices – but about Cloud-native

    applications § These may be microservices § Built with aspects in mind to be able to run them in the Cloud § But should be runnable anywhere § Typical attributes for architectures and applications – on a use-case-based spectrum § Configurability § Resiliency § Availability § Scalability § Observability Right {thing, focus, place} Cloud-native microservices - with Dapr? Cloud-native applications 12
  6. § Execution independence / Hosting-agnostic § Different programming / tech

    stacks § Running anywhere § Resiliency § Location transparency § Error handling, retries § Decoupling § Robustness § Async business processes § Observability § Seeing everything end-to- end § Tracing, logging, metrics ➡ Would be nice to have some help here § Proven patterns § By hand – OR Library, SDK, runtime? Right {thing, focus, place} Cloud-native microservices - with Dapr? Cloud-native applications: Some tedious parts 14
  7. § Portable, event-driven runtime for building distributed applications across Cloud

    and edge § Open-source, community-driven, vendor-neutral § Best practices building blocks § Consistent, portable, open APIs § Extensible & pluggable components § Adopt standards § Platform-agnostic for edge and Cloud § Any language and framework Right {thing, focus, place} Cloud-native microservices - with Dapr? Dapr: Distributed Application Runtime - for Cloud-native applications 17
  8. • “Not your concern!” • daprd will do this •

    Talk to sidecar • Use HTTP or gRPC • Use an SDK Right {thing, focus, place} Cloud-native microservices - with Dapr? Sidecar pattern: separating concerns 19 My App Dapr API POST http://localhost:3500/v1.0/invoke/cart/method/neworder GET http://localhost:3500/v1.0/state/inventory/item67 POST http://localhost:3500/v1.0/publish/shipping/orders GET http://localhost:3500/v1.0/secrets/keyvault/password HTTP/gRPC Application Sidecar
  9. Right {thing, focus, place} Cloud-native microservices - with Dapr? Dapr

    applications: utilizing platform features 20 Service A Observability Bindings & Triggers State Management Secret Management PubSub Messaging Virtual Actors Service Invocation Service B My App
  10. Right {thing, focus, place} Cloud-native microservices - with Dapr? Dapr

    components 21 My App Observability Prometheus AppInsights Jaeger Zipkin Bindings & Triggers State Stores Secret Stores PubSub Brokers https://github.com/dapr/components-contrib
  11. § Start right away with CLI § Can be integrated

    into any IDE § Focus on Dapr infrastructure aspects § VS Code tooling available § Configuration via YAML files § Config § Components § Etc. Right {thing, focus, place} Cloud-native microservices - with Dapr? Getting started with Dapr 22
  12. § Discover and invoke methods on services § Call services

    securely with encryption and apply access control on the methods § Handle retries and transient errors § Use tracing to see call graph with metrics to diagnose issues in production Right {thing, focus, place} Cloud-native microservices - with Dapr? Service invocation 25
  13. § Each app/service needs an ID § Sidecars talk to

    each other Right {thing, focus, place} Cloud-native microservices - with Dapr? Service invocation 26 Service A My App mDNS Multicast DNS component for service discovery mTLS encryption POST http://localhost:3500/v1.0/invoke/servicea/method/neworder {"data":"Hello World"} POST http://10.0.0.2:8000/neworder {"data":"Hello World"}
  14. Right {thing, focus, place} Cloud-native microservices - with Dapr? Input

    triggers 27 My App Twitter POST http://10.0.0.2:8000/newtweet {"data":“📢 We are excited to announce the …"}
  15. Right {thing, focus, place} Cloud-native microservices - with Dapr? Output

    bindings 28 My App Twilio POST http://localhost:3500/v1.0/bindings/twilio {"data":"Hello World"} Hello World
  16. § At-least-once semantics for message delivery Right {thing, focus, place}

    Cloud-native microservices - with Dapr? Publish & subscribe 30 Service B My App Redis Cache Service A POST http://localhost:3500/v1.0/publish/orders/processed {"data":"Hello World"} POST http://10.0.0.2:8000/orders http://10.0.0.4:8000/factory/orders {"data":"Hello World"}
  17. § Logs § Immutable, timestamped record of discrete events that

    happened over time § Metrics § Numeric representation of data measured over intervals of time § Traces § Representation of a series of causally related distributed events that encode the end-to-end request flow through a distributed system Right {thing, focus, place} Cloud-native microservices - with Dapr? Observability 31
  18. Right {thing, focus, place} Cloud-native microservices - with Dapr? Observability

    32 OpenTelemetry collector Logging & tracing extensions My App Redis Cache Twitter Service B Service A
  19. § Self-hosted § dapr run all your services § Infrastructure

    services can be run in Docker (mixed mode) § Docker Compose § Everything running in Docker, on-prem § Lightweight orchestration § Kubernetes § Full power of k8s orchestration § On-prem or in cloud § Azure Container Apps § Dapr built-in § Fixed version Right {thing, focus, place} Cloud-native microservices - with Dapr? Hosting anywhere 35
  20. Right {thing, focus, place} Cloud-native microservices - with Dapr? Kubernetes

    – on-prem or cloud 36 Any cloud or edge infrastructure Pod Actor partition placement Placement Pod Dapr runtime injector Injector Pod Cert authority and identity Sentry Pod Update component changes Operator Pod My App Kubelet Use components Inject Dapr sidecar into annotated pods Inject env variables Manage mTLS between services Assign spiffe identity Create mapping table of actor instances to pods Manage component updates Manage Kubernetes service endpoints Readiness and Liveness probe on healthz API to determine Dapr health state State Stores Pub/Sub Brokers Secret Stores Bindings & Triggers Observability Dapr Components Operator Deploys and manages Dapr
  21. § Choose wisely – be pragmatic § LOLA: sometimes abstractions

    just leak § State management building block § Very limited use cases § Has custom API for querying § Too much of an abstraction Right {thing, focus, place} Cloud-native microservices - with Dapr? Dapr-all-the-things? 39
  22. Recap Right {thing, focus, place} Cloud-native microservices - with Dapr?

    40 YOU need to choose: Dapr abstraction or not Modern applications need to be Cloud-native Microservices are just one architecture style (and more) Dapr 😀 § Encapsulates proven patterns in building blocks § Pluggable components § Language-agnostic § Host-agnostic No technology, framework, runtime can solve business domain problems Dapr 🤔 § Some features seem incomplete § Docs and samples need to be improved § Might be overhead