Please enable JavaScript.
Coggle requires JavaScript to display documents.
Microservices - Coggle Diagram
Microservices
Design Patterns
Database Patterns
-
-
-
CQRS Pattern
-
Data Models are kept separate for reads and writes. Command Model and Query Model are kept separate.
Two DBs are maintained. In first DB, Command Models does Write operation against fully normalized DB while Query model does write operation against the second DB.
-
-
-
Event Sourcing Pattern
Any event triggered will be stored in Event Store and no direct update or delete operations are performed on Data.
This structure enables 1. create Event-Driven Architecture, helps publish event whenever state changes, 2. Maintains Audit Logs of Records and 3. solves atomicity problems
-
-
Saga Pattern
When a sequence of local transactions across Microservices occurs, each transactions update data and publishes a message over a event to trigger next local transaction in Saga.
-
Two types of Transactions can happen in Saga -
- Choreography Based and
- Orchestration Based.
- Choreography Based transaction
There is no central System which controls the Transactions. Each service produces and listens to the events triggered by other Service and the last service generates the output or response. Services are connected over Message Queue.
-
- Orchestration Based transaction
There is a central system called an Orchestration service which controls the flow and event data is aggregated by Orchestration service.
-
Observatory Patterns
Enables logging, Performance metrics and enabling distributed tracing
Measures Health of Microservice across the architecture and there supported Business Transactions. This is must in a Distributed Environment.
-
-
-
4. Health Check Pattern
Newly deployed service might not be ready to accept request, it would be pointless for Deployment Orchestration Architecture to route the request to service until it is ready to process them. DB conn timeout can a reason for failure.
-
Integration Patterns
-
API Gateway Pattern
Designing a multiple and complex Microservices with multiple client Apps, would need a single entry point. API Gateway is responsible for 1. Request Routing, 2. API Composition and 3. Protocol Translation.
-
API-Gateway Features
-
-
-
-
Retry Policies, Circuit Breaker and Quality-Of-Service
-
Logging, Tracing and Correlation
Headers, Query Strings, and Claims Transformation
-
-
-
Aggregator Pattern
Since, services are small, Client calls the Aggregator Service which calls all the small services, aggregates the response and sends to the client App
-
Proxy Pattern
Proxy is variation of Aggregator model. This is just an extra layer on top of services and enhances security.
-
Gateway Routing Pattern
Provides abstraction to the backend services to client and any changes in endpoint wouldn't affect the client apps
-
-
Branch Pattern
Extended version of Aggregator and Chain Pattern. Here, each service will communicate with all other services concurrently.
-
-
-
Decomposition Patterns
-
-
-
Strangler Pattern
The Strangler Application grows larger over time. Functionalities in Monolith application are replaced by a Microservice. This is specially useful when transforming Monolith Appln to Microservices.
-
Bulkhead Pattern
Bulkhead creates sections in Cargo ship restricting flood and fire to specific section. Each service works in it's penury and Failure in one service is restricted to a specific service
Sidecar Pattern
Resembles Sidecar attached to a motorcycle. Sidecar implements peripheral features such as 1. Platform abstraction, 2. Proxy to remote services, 3. Logging and 4. Configuration, while Primary Application implements Core Functionality.
Definition
Microservices are suite of small services, autonomously developed, independently deployable, decentralized and built and released with automated processes
-
-
Design Principles
-
-
-
-
-
-
Fault Tolerant
should be resilient to failures of service and the failure should have minimum impact on other services. it shouldn't be a Circuit breaker.
Hexagonal Architecture
Architecture style to build a microservice. Also known as Onion Architecture. Has, Controller, Service Layer, Business Layer and Repo Layer.
-
Consists of Inbound Adapter - Controller (API Endpoints) or Message Consumer from Message Broker. Outbound Adapter - DAO or Message Producer to Message Broker. Also contains Service Layer and Business Layer
-
-
-
-
-