
A pattern language for microservices Chris Richardson Founder of Eventuate.io Founder of the original CloudFoundry.com Author of POJOs in Action @crichardson [email protected] http://microservices.io http://eventuate.io http://plainoldobjects.com Copyright © 2017. Chris Richardson Consulting, Inc. All rights reserved @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it to architect an application @crichardson About Chris @crichardson About Chris Consultant and trainer focusing on modern application architectures including microservices (http://www.chrisrichardson.net/) @crichardson About Chris Founder of a startup that is creating an open-source/SaaS platform that simplifies the development of transactional microservices (http://eventuate.io) @crichardson About Chris https://www.manning.com/books/microservice-patterns @crichardson Agenda Why microservices? Benefits of the microservice architecture Microservices != silver bullet The microservice pattern language Applying the microservice pattern language @crichardson Let’s imagine you are building an online store REST/JSON Browser/ StoreFrontUI Client HTML Catalog Module Recommendation SQL Module Database Review Module Order Module Layered and modular @crichardson Problem: what’s the deployment architecture? @crichardson Forces Businesses must innovate faster ⇒ Develop more complex, higher-quality software faster @crichardson Traditional Monolithic architecture WAR/EAR StoreFrontUI HTML Catalog REST/JSON Browser/ Module MySQL Client Database Recommendation Module Review Module Order Module Tomcat @crichardson Simple to …. Develop Test Deploy Scale @crichardson Successful applications have a habit of growing ⇒ Big, complex, monolithic applications @crichardson Eventually, agile development and deployment becomes impossible @crichardson Requires long-term commitment to a technology stack @crichardson Monolithic hell Development is slow Application is becoming a big ball of mud No one fully understands the application It’s written in an obsolete technology stack @crichardson The microservice architecture Loosely coupled services organized around business capabilities @crichardson The Microservice architecture tackles complexity through modularization @crichardson Microservice architecture HTML Store Catalog Catalog Browser Front UI Service Database REST Review Review Service Database API Gateway REST Order Order Service Database Mobile Device … … Service Database @crichardson Agenda Why microservices? Benefits of the microservice architecture Microservices != silver bullet The microservice pattern language Applying the microservice pattern language @crichardson Microservices enable continuous delivery/deployment Process: Continuous delivery/deployment Enables Enables Successful Software Development Organization: Architecture: Small, agile, autonomous, Microservice architecture cross functional teams Enables @crichardson Smaller, simpler applications Easier to understand and develop Less jar/classpath hell - who needs OSGI? Faster to build and deploy Reduced startup time @crichardson Scales development: develop, deploy and scale each service independently Catalog Responsible Catalog Team for Service Small, autonomous teams Review Review Clearly defined Team Service responsibilities Order Order Team Service … … Team Service Easier to scale @crichardson Improves fault isolation @crichardson Easily evolve your technology stack ... and fail safely @crichardson Agenda Why microservices? Benefits of the microservice architecture Microservices != silver bullet The microservice pattern language Applying the microservice pattern language @crichardson No silver bullets http://en.wikipedia.org/wiki/Fred_Brooks @crichardson Complexity http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html @crichardson Complexity of developing a distributed system @crichardson Multiple databases & Transaction management Must use event-driven eventual consistency @crichardson Complexity of testing a distributed system @crichardson Complexity of deploying and operating a distributed system Yo u n e e d a lot o f automation: VM/container orchestration or PaaS @crichardson Developing and deploying features that span multiple services requires careful coordination @crichardson Agenda Why microservices? Benefits of the microservice architecture Microservices != silver bullet The microservice pattern language Applying the microservice pattern language @crichardson Are microservices a good fit for my application? @crichardson When using microservices: How to decompose an application into services? How to deploy an application’s services? How to handle cross cutting concerns? Which communication mechanisms to use? How do external clients communicate with the services? How does a client discover the network location of a service instance? How to prevent a network or service failure from cascading to other services? How to maintain data consistency and implement queries? How to understand the behavior of an application and troubleshoot problems? How to make testing easier? How to implement a UI screen or page that displays data from multiple services? @crichardson Microservice pattern language = collection of patterns that solve these architecture, design, development and operational problems @crichardson What’s a pattern? Reusable solution to a problem occurring in a particular context @crichardson The structure of a pattern Name Context aka the situation Problem (conflicting) issues Forces etc to address Solution Resulting context Related patterns @crichardson Benefits Resulting context Drawbacks Issues to resolve @crichardson Alternative pattern: Different solution to same problem Related patterns Successor pattern: Solves problem introduced by this pattern @crichardson Microservices pattern language: http://microservices.io Motivating Solution Pattern Pattern Application patterns Solution A Solution B Server-side page General Specific CQRS Service Integration fragment Event Contract Test sourcing composition Decompose by Event-driven business capability Shared Database per architecture database Service Transaction Client-side UI log tailing Service composition Component Test Decompose by Database architecture subdomain Testing UI Database Decomposition triggers Application Application Audit logging events metrics Monolithic Maintaining data consistency architecture Application Infrastructure patterns Distributed Health check tracing API Remote Procedure Messaging Invocation Microservice Externalized Access Token Circuit Breaker Chassis configuration Exception Log Domain-specific Reliability tracking aggregation Cross-cutting concerns Security Communication style Observability Microservice architecture Core Client-side discovery Self registration Infrastructure patterns Multiple Services Single Service per Service registry per host Host API gateway Serverless deployment Server-side 3rd party registration discovery Backend for front end Discovery Service-per- Service-per-VM Container Service deployment External API platform Deployment Communication patterns Microservice patterns @crichardson Microservices pattern language: http://microservices.io Motivating Solution Pattern Pattern Application patterns Solution A Solution B Server-side page General Specific CQRS Service Integration fragment Event Contract Test sourcing composition Decompose by Event-driven business capability Shared Database per architecture database Service Transaction Client-side UI log tailing Service composition Component Test Decompose by Database architecture subdomain Testing UI Database Decomposition triggers Application Application Audit logging events metrics Monolithic Maintaining data consistency architecture Application Infrastructure patterns Distributed Health check tracing API Remote Procedure Messaging Invocation Microservice Externalized Access Token Circuit Breaker Chassis configuration Exception Log Domain-specific Reliability tracking aggregation Cross-cutting concerns Security Communication style Observability Microservice architecture Core Client-side discovery Self registration Infrastructure patterns Decomposition Multiple Services Single Service per Service registry per host Host API gateway Base Serverless deployment Server-side 3rd party registration Technical discovery Backend for front end Discovery Architecture Service-per- Service-per-VM Container Service deployment External API platform Dev/Ops Deployment Concerns Communication patterns Microservice patterns @crichardson Agenda Why microservices? Benefits of the microservice architecture Microservices != silver bullet The microservice pattern language Applying the microservice pattern language @crichardson The pattern language guides you when developing an architecture What architectural decisions you must make For each decision: Available options Trade-offs of each option @crichardson Issue: What’s the deployment architecture? Monolithic Forces architecture Single deployable/ executable OR Maintainability Tightly coupled services Deployability Testability Extensibility Multiple loosely coupled … Microservice architecture services Issue: How to decompose an application into services? Forces Organize around business capabilities Decompose by Stability business capability Cohesive Decompose by Loosely coupled subdomain Organize around DDD Not too large subdomains Issue: How to deploy an application’s services? Forces Multiple Services Single Service per Multiple languages per host Host Isolated
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages57 Page
-
File Size-