Microservices Architecture:
The Design Principles
Microservices Design Principles
Rag Dhiman
Pluralsight Author
@RagDhiman
Microservices Architecture
Structured Synchronous Continuous
Correlation ID Cache Stateless Serverless Coupling
Logging Communication Integration
Strangler
Asynchronous Temporal Load Continuous
Micro Database Timeouts
Communication Coupling Microservices Balancer
Application
Delivery
REST
Pattern
Circuit Event-Driven API
Fail Fast BFF API Authentication SOA ACID
Breaker Communication Gateway
Bounded Container Eventual
Event Storming API Catalogue Containers Authentication Retry Policy consistency
Context Orchestration
Course Overview
1 2 3
4 5 6 1 2 3 4 5 6
Approach to Microservice
Microservices Design
Design Principles
Principles
1
5 3 5
1 2 3 4 5 6 1 2 3 6
1 3 2 5 6
4 5 1 4
2 4
Technologies for
Moving Forward and
Microservices
Maturing Microservices
Architecture
Microservices Architecture
? ? ? ? ? ? ? ?
? ? ? ? Microservices
Architecture ? ? ? ?
? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ?
1 2 3 4 5 6
Target Audience
Business Engineer
Microservices introduction
Overview - What is a service?
- Microservices architecture
- Microservices communication design
- The monolith
- Microservices success
- Monolith vs. microservices
Microservices design principles
Microservices Introduction
What Is a Service?
Website Web App
Mobile App Database
Service
Desktop App Internet
(Network)
What Is a Service?
Website Web App
Service
Mobile App
Database
ESB Service
Desktop App Internet
(Network)
What Is a Service?
Website Server 1
Server 2
Mobile App Database Cluster
Server 3
Desktop App Internet
On-Premise
(Network)
What Is a Service?
Website VM 1
VM 2
Mobile App Cloud database
VM 3
Desktop App Internet
Cloud
(Network)
Microservices Architecture
Microservices Architecture
Website Web App
Mobile App
? Database
Service
Desktop App Internet
(Network)
Microservices Architecture
Website Web App
Account Product
Mobile App Promotion Inventory Database
Order
Desktop App Internet
(Network)
Microservices Architecture
Website Web App
Account Product
Mobile App Promotion Inventory
Order
Desktop App Internet
(Network)
Microservices Architecture
?
Website Web App
Account Product
?
Mobile App Inventory
?
Promotion
Order
Desktop App Internet
(Network)
Authorization
Microservices Architecture
Authentication
Worker Service
API Based Service
Eventual consistency
Avoid Distributed Website Security Web App BFF API Service Registry
Transactions
Fire and forget calls
Messages/Events
Message Broker
Asynchronous
Communication BFF API Account Product
Caches Mobile App
Temporal Coupling
Request and
Response (wait) calls Message Broker
Synchronous
Communication
API Gateway API Gateway
Service Registry Inventory
Desktop App Order Promotion
Stateless Instances
Load Balancer
Internet
BFF API
(Network)
Authorization
Microservices Architecture
Authentication
Worker Service
API Based Service
Eventual consistency
IAM
Avoid Distributed Website Security Web App BFF API Service Registry
Transactions
Fire and forget calls
Messages/Events
Message Broker
Asynchronous
Communication BFF API Account Product
Caches Mobile App
Temporal Coupling
Request and
Response (wait) calls Message Broker
Synchronous
Communication
API Gateway API Gateway
Service Registry Inventory
Desktop App Order Promotion
Stateless Instances
Load Balancer
Internet
BFF API
(Network)
Cheat-sheet: Microservices Architecture
SOA with application-level scope for services
Smaller services with a cohesive focus
Independent data storage
API Scalable, performant, and flexible applications
Gateway
Web
App High availability and reliable application
BFF Technology agnostic services
MS Independently changeable and deployable
BFF Network communication mechanism
Sync and async com to avoid distributed transactions
MS MS Centralized tooling for management
The Monolith
The Pure Monolith
Account
Product
Website
Web App
+ Data
Promotion
Access
API
Endpoints
Inventory
Mobile App Database
Order
Presentation Business Data
Layer Layer Layer
Web App
Desktop App Internet
(Network)
Services with Monolith Challenges
Account
Product
Website Web App
API Data
Promotion
Endpoints Access
Inventory
Mobile App Database
Order
Presentation Business Data
Layer Layer Layer
Service
Desktop App Internet
(Network)
Microservices Ready Monolith
API Data
Account
Endpoints Access
API Data
Product
Website Web App Endpoints Access
API Data
Promotion
Endpoints Access
API Data
Inventory
Endpoints Access
Mobile App Database
API Data
Order
Endpoints Access
Presentation Business Data
Layer Layer Layer
Service
Desktop App Internet
(Network)
Microservices Monolith
Website Web App
Account Product
Mobile App Promotion Inventory
Order
Desktop App Internet
(Network)
Cheat-sheet: The Monolith
No restriction on size
Longer development and deployment
Inaccessible features
Fixed technology stack
API
Gateway High levels of coupling
Web
App
Failure could affect the whole system
BFF
MS Inefficient scaling
Minor change results in entire system deployment
BFF
Easy to replicate the environment
Quick solution for startups and prototyping
MS MS
Monolith is an alternative
Microservices Success
Microservices Success: Why
Website Security Web App BFF API Service Registry Your Team
Your Rivals
BFF API Account Product
Order Mobile App
Message Broker
API Gateway
Order Promotion Inventory
Desktop App
Internet
(Network)
Microservices Success: Why
Website Security Web App BFF API Service Registry Your Team
BFF API Account Product
Mobile App
Message Broker
API Gateway
Order Promotion Inventory
Desktop App
Internet
(Network)
Microservices Success: Why
Website Security Web App BFF API Service Registry
BFF API Account Product
Mobile App
Message Broker
API Gateway
Order Promotion Inventory
Desktop App
Internet
(Network)
Microservices Success: Why
Website Security Web App BFF API Service Registry
Accounts Team Product Team
BFF API Account Product
Mobile App
Message Broker
Orders Team Inventory Team
API Gateway
Order Promotion Inventory
Desktop App
Internet
Promotions Team
Microservices Success: Why
Code
Changes
Website Security Web App BFF API Service Registry
BFF API Account Product Source Control
Mobile App
Message Broker
API Gateway Build Server
Order Promotion Inventory
Desktop App
Internet
(Network)
Deployment
Microservices Success: Why
Website Security Web App BFF API Service Registry
Dev Team One: Dev Team Two:
Feature One Feature Two
BFF API Account Product
Mobile App
Message Broker
Dev Team Three: Dev Team Five:
Feature Three Feature Five
API Gateway
Order Promotion Inventory
Desktop App
Internet
Dev Team Four:
Feature Four
Microservices Success: Why
Website Security Web App BFF API Service Registry
BFF API Account Product
Mobile App
Message Broker
API Gateway
Order Promotion Inventory
Desktop App
Internet
(Network)
Microservices Success: Why
On-Premise
Applications
Security Web App BFF API Service Registry
Data
Runtime
Middleware
BFF API Account Product
OS
Virtualization
Message Broker
Servers
Storage API Gateway
Order Promotion Inventory
Networking
Microservices Success: Why
IAAS
Applications
Security Web App BFF API Service Registry
Data
Runtime
Middleware
BFF API Account Product
OS
Virtualization
Message Broker
Servers
Storage API Gateway
Order Promotion Inventory
Networking
Microservices Success: Why
PAAS
Applications
Security Web App BFF API Service Registry
Data
Runtime
Middleware
BFF API Account Product
OS
Virtualization
Message Broker
Servers
Storage API Gateway
Order Promotion Inventory
Networking
Microservices Success: Why
Microservice
1
Microservice Microservice
4 2
Service
Microservice
3
Transform
Eliminate
Coexist
Cheat-sheet: Microservice Success
Competitive software market Shorter development times
Mandatory reliability Reliable and faster deployment
Business domain-driven design Enables frequent updates
Automated test tools Decouple the changeable parts
Automated deployment tools Security
Agile practices Increased uptime
Cloud and on-premise hosting Fast issue resolution
Embrace new technology Highly scalable and better performance
Performance via async communication Better ownership and knowledge
Simpler technology Right technology
Methodical transition strategies Enables distributed teams
Demo
Monolith vs. Microservices
- Your typical monolith
- Microservices version
Microservices Design Principles
Microservices Design Principles
Domain-driven
Autonomous Ownership Culture
Cohesion
Each service is independently Each service is a product with a team
changeable and deployable Each service represents a specific part behind it
of the business with a cohesive focus
Resiliency Observability Automation
Each service fails fast and alternates Workflows and component health is Tools for automated hosting, testing
functionality visible and traceable and deployment
Microservices introduction
Summary - What is a service?
- Microservices architecture
- Microservices communication design
- The monolith
- Microservices success
- Monolith vs. microservices
Microservices design principles