0
0
Microservicessystem_design~12 mins

High cohesion in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - High cohesion

This system demonstrates high cohesion in a microservices architecture. Each microservice is focused on a single business capability, making the system easier to maintain and scale. The key requirement is to keep services independent and specialized for better reliability and development speed.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  +----------------+----------------+----------------+
  |                |                |
  v                v                v
Order Service   Payment Service   Inventory Service
  |                |                |
  v                v                v
Order DB        Payment DB       Inventory DB
  |
  v
Cache (per service)
Components
User
user
End user who sends requests to the system
Load Balancer
load_balancer
Distributes incoming user requests evenly to API Gateway instances
API Gateway
api_gateway
Routes requests to appropriate microservices based on the request type
Order Service
service
Handles all order-related operations, focused on order management
Payment Service
service
Manages payment processing independently from other services
Inventory Service
service
Manages inventory data and stock levels separately
Order DB
database
Stores order data for the Order Service
Payment DB
database
Stores payment transaction data for the Payment Service
Inventory DB
database
Stores inventory information for the Inventory Service
Cache
cache
Speeds up read operations by caching frequently accessed data per service
Request Flow - 11 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayOrder Service
Order ServiceCache
CacheOrder Service
Order ServiceOrder DB
Order DBOrder Service
Order ServiceCache
Order ServiceAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Order DB
Impact:Order Service cannot save new orders; reads may still succeed from cache but writes fail
Mitigation:Use database replication and failover to a standby DB; cache serves read requests temporarily
Architecture Quiz - 3 Questions
Test your understanding
Which component directs user requests to the correct microservice?
ALoad Balancer
BCache
CAPI Gateway
DDatabase
Design Principle
This architecture shows high cohesion by assigning each microservice a single responsibility with its own database and cache. This separation reduces dependencies, making the system easier to maintain and scale.