Design
Patterns for Microservice
Microservice
architecture has become the de facto choice for modern application development.
Though it solves certain problems, it is not a silver bullet. It has several
drawbacks and when using this architecture, there are numerous issues that must
be addressed. This brings about the need to learn common patterns in these
problems and solve them with reusable solutions. Thus, design patterns for
microservices need to be discussed. Before we dive into the design patterns, we
need to understand on what principles microservice architecture has been built:
1. Scalability
2. Availability
3. Resiliency
4. Independent, autonomous
5. Decentralized governance
6. Failure isolation
7. Auto-Provisioning
8. Continuous delivery through DevOps
1.
Decomposition Patterns
a.
Decompose by Business Capability
b.
Decompose by Subdomain
c. Strangler
Pattern
2.
Integration Patterns
a. API
Gateway Pattern
b.
Aggregator Pattern
c.
Client-Side UI Composition Pattern
3.
Database Patterns
a.
Database per Service
b. Shared
Database per Service
c.
Command Query Responsibility Segregation (CQRS)
d. Saga
Pattern
1. Choreography — When there is no central
coordination, each service produces and listens to another service’s events and
decides if an action should be taken or not.
2. Orchestration — An orchestrator (object)
takes responsibility for a saga’s decision making and sequencing business
logic.
4.
Observability Patterns
a. Log
Aggregation
b.
Performance Metrics
c.
Distributed Tracing
d. Health
Check
5.
Cross-Cutting Concern Patterns
a.
External Configuration
b.
Service Discovery Pattern
c.
Circuit Breaker Pattern
d.
Blue-Green Deployment Pattern
No comments:
Post a Comment