A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation...
Transcript of A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation...
![Page 1: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/1.jpg)
@crichardson
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
![Page 2: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/2.jpg)
@crichardson
Presentation goal
Overview of the microservice architecture pattern language
and how to use it to architect an
application
![Page 3: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/3.jpg)
@crichardson
About Chris
![Page 4: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/4.jpg)
@crichardson
About Chris
Consultant and trainer focusing on modern
application architectures including microservices
(http://www.chrisrichardson.net/)
![Page 5: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/5.jpg)
@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)
![Page 6: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/6.jpg)
@crichardson
About Chris
https://www.manning.com/books/microservice-patterns
![Page 7: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/7.jpg)
@crichardson
Agenda
Why microservices?
Benefits of the microservice architecture
Microservices != silver bullet
The microservice pattern language
Applying the microservice pattern language
![Page 8: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/8.jpg)
@crichardson
Let’s imagine you are building an online store
Browser/Client
SQL Database
Review Module
Catalog Module
Recommendation Module
StoreFrontUI
Order Module
HTML
REST/JSON
Layered and modular
![Page 9: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/9.jpg)
@crichardson
Problem: what’s the deployment architecture?
![Page 10: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/10.jpg)
@crichardson
Forces
Businesses must innovate faster ⇒
Develop more complex, higher-quality software faster
![Page 11: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/11.jpg)
@crichardson
Tomcat
Traditional Monolithic architecture
Browser/Client
WAR/EAR
MySQL Database
Review Module
Catalog Module
Recommendation Module
StoreFrontUI
Order Module
HTMLREST/JSON
![Page 12: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/12.jpg)
@crichardson
Simple to ….
Develop Test
Deploy Scale
![Page 13: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/13.jpg)
@crichardson
Successful applications have a habit of growing
⇒ Big, complex, monolithic
applications
![Page 14: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/14.jpg)
@crichardson
Eventually, agile development
and deployment becomes
impossible
![Page 15: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/15.jpg)
@crichardson
Requires long-term commitment to a technology stack
![Page 16: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/16.jpg)
@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
![Page 17: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/17.jpg)
@crichardson
The microservice architecture
Loosely coupled services organized around
business capabilities
![Page 18: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/18.jpg)
@crichardson
The Microservice architecture tackles complexity through
modularization
![Page 19: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/19.jpg)
@crichardson
Microservice architecture
Browser
Mobile Device
Store Front UI
API Gateway
Catalog Service
Review Service
Order Service
… Service
Catalog Database
Review Database
Order Database
… Database
HTML
REST
REST
![Page 20: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/20.jpg)
@crichardson
Agenda
Why microservices?
Benefits of the microservice architecture
Microservices != silver bullet
The microservice pattern language
Applying the microservice pattern language
![Page 21: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/21.jpg)
@crichardson
Microservices enable continuous delivery/deployment
Process: Continuous delivery/deployment
Organization:Small, agile, autonomous,
cross functional teams
Architecture: Microservice architecture
Enables
Enables Enables
SuccessfulSoftware
Development
![Page 22: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/22.jpg)
@crichardson
Smaller, simpler applications
Easier to understand and develop
Less jar/classpath hell - who needs OSGI?
Faster to build and deploy
Reduced startup time
![Page 23: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/23.jpg)
Scales development: develop, deploy and scale each service independently
Small, autonomous teams
Clearly defined responsibilities
Catalog Service
Review Service
Order Service
… Service
Catalog Team
Review Team
Order Team
… Team
Responsible for
![Page 24: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/24.jpg)
@crichardson
Easier to scale
![Page 25: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/25.jpg)
@crichardson
Improves fault isolation
![Page 26: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/26.jpg)
@crichardson
Easily evolve your technology stack
... and fail safely
![Page 27: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/27.jpg)
@crichardson
Agenda
Why microservices?
Benefits of the microservice architecture
Microservices != silver bullet
The microservice pattern language
Applying the microservice pattern language
![Page 28: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/28.jpg)
@crichardson
No silver bullets
http://en.wikipedia.org/wiki/Fred_Brooks
![Page 29: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/29.jpg)
@crichardson
Complexity
http://highscalability.com/blog/2014/4/8/microservices-not-a-free-lunch.html
![Page 30: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/30.jpg)
@crichardson
Complexity of developing a distributed system
![Page 31: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/31.jpg)
@crichardson
Multiple databases &
Transaction managementMust use event-driven eventual consistency
![Page 32: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/32.jpg)
@crichardson
Complexity of testing a distributed system
![Page 33: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/33.jpg)
@crichardson
Complexity of deploying and operating a distributed system
You need a lot of automation: VM/container
orchestration or PaaS
![Page 34: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/34.jpg)
@crichardson
Developing and deploying features that span multiple services requires careful coordination
![Page 35: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/35.jpg)
@crichardson
Agenda
Why microservices?
Benefits of the microservice architecture
Microservices != silver bullet
The microservice pattern language
Applying the microservice pattern language
![Page 36: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/36.jpg)
@crichardson
Are microservices a good fit for my application?
![Page 37: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/37.jpg)
@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 make testing easier?
How to understand the behavior of an application and troubleshoot problems?
How to implement a UI screen or page that displays data from multiple services?
![Page 38: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/38.jpg)
@crichardson
Microservice pattern language =
collection of patterns that solve these
architecture, design, development and operational problems
![Page 39: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/39.jpg)
@crichardson
What’s a pattern?
Reusable solution to a problem
occurring in a particular context
![Page 40: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/40.jpg)
@crichardson
The structure of a pattern
Resulting context
aka the situation
Name
Context
Problem
Related patterns
(conflicting) issues etc to address Forces
Solution
![Page 41: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/41.jpg)
@crichardson
Resulting context
Benefits
Drawbacks
Issues to resolve
![Page 42: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/42.jpg)
@crichardson
Related patterns
Alternative pattern: Different solution to same problem
Successor pattern: Solves problem introduced by this pattern
![Page 43: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/43.jpg)
@crichardsonMicroservice patterns
Communication patterns
Core
Cross-cutting concerns Security
Deployment
Maintaining data consistency
Database architecture
External API
Reliability
Discovery
Communication style
Testing
Observability
UI
Decomposition
API gateway
Client-side discovery
Server-side discovery
Service registry
Self registration
3rd party registration
Multiple Services per host
Single Service per Host
Service-per-Container
Service-per-VM
Messaging Remote ProcedureInvocation
Database per Service
Event-driven architectureShared
database
Microservice Chassis
Backend for front end
Event sourcing
Transaction log tailing
Database triggers
Application events
Monolithic architecture
Microservice architecture
CQRS
MotivatingPattern
SolutionPattern
Solution A Solution B
General Specific
Serverless deployment
Circuit BreakerAccess Token
Domain-specific
Externalized configuration
Service Integration Contract Test
Service Component Test
Exception tracking
Distributed tracing
Audit logging Application metrics
Log aggregation
Health check API
Service deployment platform
Server-side page fragment
composition
Client-side UI composition
Decompose bybusiness capability
Decompose bysubdomain
Application patterns
Infrastructure patterns
Application Infrastructure patterns
Microservices pattern language: http://microservices.io
![Page 44: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/44.jpg)
@crichardsonMicroservice patterns
Communication patterns
Core
Cross-cutting concerns Security
Deployment
Maintaining data consistency
Database architecture
External API
Reliability
Discovery
Communication style
Testing
Observability
UI
Decomposition
API gateway
Client-side discovery
Server-side discovery
Service registry
Self registration
3rd party registration
Multiple Services per host
Single Service per Host
Service-per-Container
Service-per-VM
Messaging Remote ProcedureInvocation
Database per Service
Event-driven architectureShared
database
Microservice Chassis
Backend for front end
Event sourcing
Transaction log tailing
Database triggers
Application events
Monolithic architecture
Microservice architecture
CQRS
MotivatingPattern
SolutionPattern
Solution A Solution B
General Specific
Serverless deployment
Circuit BreakerAccess Token
Domain-specific
Externalized configuration
Service Integration Contract Test
Service Component Test
Exception tracking
Distributed tracing
Audit logging Application metrics
Log aggregation
Health check API
Service deployment platform
Server-side page fragment
composition
Client-side UI composition
Decompose bybusiness capability
Decompose bysubdomain
Application patterns
Infrastructure patterns
Application Infrastructure patterns
Microservices pattern language: http://microservices.io
Base Technical
Architecture
Dev/Ops Concerns
Decomposition
![Page 45: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/45.jpg)
@crichardson
Agenda
Why microservices?
Benefits of the microservice architecture
Microservices != silver bullet
The microservice pattern language
Applying the microservice pattern language
![Page 46: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/46.jpg)
@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
![Page 47: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/47.jpg)
Issue: What’s the deployment architecture?Forces
Maintainability
Deployability
Testability
Extensibility
…
Monolithic architecture
Microservice architecture
Single deployable/executable OR
Tightly coupled services
Multiple loosely coupled services
![Page 48: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/48.jpg)
Issue: How to decompose an application into services?
Forces
Stability
Cohesive
Loosely coupled
Not too large
Decompose bybusiness capability
Decompose bysubdomain
Organize around business capabilities
Organize around DDD subdomains
![Page 49: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/49.jpg)
Issue: How to deploy an application’s services?
Multiple Services per host
Single Service per Host
Service-per-Container
Service-per-VM
Serverless deployment
Service deployment platform
Forces
Multiple languages
Isolated
Constrained
Monitor-able
Reliable
Efficient
![Page 50: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/50.jpg)
@crichardson
Issue: How do services communicate?
Messaging Remote ProcedureInvocation
Domain-specific
Forces
Services must communicate
Usually processes on different machines
…
![Page 51: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/51.jpg)
@crichardson
Issue: How to discover a service instance’s network location?
Client-side discovery
Server-side discovery
Service registry
Self registration
3rd party registration
Forces
Client needs IP address of service instance
Dynamic IP addresses
Dynamically provisioned instances
![Page 52: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/52.jpg)
@crichardson
Issue: How to handle cross cutting concerns?
Microservice Chassis
Forces
Every service must implement logging; externalize configuration; health check endpoint; metrics; …
![Page 53: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/53.jpg)
@crichardson
Issue: how to maintain data consistency?
Event-driven architecture
Event sourcing
Transaction log tailing
Database triggers
Application events
Context
• Each service has its own database
• Data is private to a service
Forces
Transactional data consistency must be maintained across multiple services
2PC is not an option
![Page 54: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/54.jpg)
@crichardson
Issue: how to perform queries?
CQRS
Context
Each service has its own database
Forces
Queries must join data from multiple services
Data is private to a serviceMaintain query views by subscribing to events
![Page 55: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/55.jpg)
@crichardson
Issue: how to monitor the behavior of your application?
Exception tracking
Distributed tracing
Audit logging Application metrics
Log aggregation
Health check API
![Page 56: A pattern language for microservices - Huodongjia.com · 2017-09-26 · @crichardson Presentation goal Overview of the microservice architecture pattern language and how to use it](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ecd4cd6bdf3a53aec2fa8f1/html5/thumbnails/56.jpg)
@crichardson
Summary
The monolithic architecture is a good choice for small/simple applications
Use the microservice architecture for large/complex applications
Micro service architecture != silver bullet
Use the microservice architecture pattern language to guide your decision making