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

Designing cloud-native microservices using patt...

Designing cloud-native microservices using patterns

Designing cloud-native microservices using patterns
Felix Coutinho
Cloud-native applications are a collection of small, independent, and loosely coupled services. How can you as a developer or an architect design microservices that comply with this definition? And more, how can you do this using industry-level design patterns such as fanout, mat-view, observability, CQRS?

The intent of this talk is to give real-world examples and feed the participants with confidence that cloud-native microservices are possible to implement since you design them properly.

Felix Coutinho

June 09, 2021
Tweet

More Decks by Felix Coutinho

Other Decks in Programming

Transcript

  1. Design patterns “A design pattern is a general repeatable solution

    to a commonly occurring problem in software design. A design pattern isn't a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations.” - Alexander Shvets on Dive into Design Patterns
  2. Design patterns The problem “An intersection between two roads is

    causing issues. People are getting injured and traffic is getting slow.”
  3. Design patterns “A design pattern isn't a finished design that

    can be transformed directly into code” - Alexander Shvets on Dive into Design Patterns You need to identify the problem, understand the scenario and choose the best solution
  4. Cloud Native Definition “Cloud-native applications are a collection of small,

    independent, and loosely coupled services.” https://www.redhat.com/en/topics/cloud-native-apps * Small * Independent * Loosely Coupled
  5. Decompose by subdomain * Small * Loosely Coupled Solution Define

    services corresponding to Domain-Driven Design (DDD) subdomains.
  6. Source Łukasz. 2018. "The nature of Domain Driven Design -

    what the heck is it?" Braintelligence, Accessed on May 2021
  7. Database per service * Loosely Coupled Solution Keep each microservice’s

    persistent data private to that service and accessible only via its API.
  8. Problem How to implement a query that retrieves data from

    multiple services in a microservice architecture?
  9. (CQRS) Command Query Responsibility Segregation * Independent Solution Define a

    view database, which is a read-only replica that is designed to support that query. The application keeps the replica up to data by subscribing to Domain events published by the service that own the data.
  10. Materialized Views * Independent * Loosely Coupled Solution Generate, in

    advance, a view that materializes the data in a format suited to the required results set
  11. Event sourcing / Fan-out * Independent * Loosely Coupled Solution

    Whenever the state of a business entity changes, a new event is appended to the list of events. When a service saves an event in the event store, it is delivered to all interested subscribers.
  12. Distributed tracing * Independent Solution Assigns each external request a

    unique id and includes this id in all log messages associated.
  13. Problem How to communicate the identity of the requestor to

    the services that handle the request?
  14. Access Token * Independent * Loosely Coupled Solution User a

    access token (possible JWT) that securely identifies the requestor in each request to the services.
  15. Quer dar um upgrade no seu setup? A CI&T te

    ajuda! Participe do nosso sorteio e concorra a R$2.000,00 em créditos para equipar o seu home office. Inscreva-se no formulário do estande CI&T.
  16. References Books Dive into Design Patterns - Alexander Shvets Microservices

    patterns - Chris Richardson Domain-Driven Design - Eric Evans Designing Distributed Systems - Brendan Burns Monolith to Microservices - Sam Newman Building Microservices - Sam Newman Beyond the Twelve-Factor App - Kevin Hoffman Patterns, Principles, and Practices of Domain-Driven Design - Scott Millett, Nick Tune Cloud Design Patterns - Alex Homer, John Sharp, Larry Brader, Masashi Narumoto, Trent Swanson Building Event-Driven Microservices - Adam Bellemare Links https://github.com/cncf/toc/blob/main/DEFINITION.md https://docs.microsoft.com/en-us/dotnet/architecture/cloud-native/definition https://www.redhat.com/en/topics/cloud-native-apps https://microservices.io/index.html