0
0
Microservicessystem_design~12 mins

Health check pattern in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Health check pattern

This system uses the health check pattern to monitor the status of microservices. It ensures that the load balancer only sends user requests to services that are healthy and ready to respond. The system must detect failures quickly and avoid sending traffic to unhealthy services.

Architecture Diagram
User
  |
  v
Load Balancer <--> Health Check Service
  |
  v
+-------------------+    +-------------------+
| Microservice A     |    | Microservice B     |
| (with Health API)  |    | (with Health API)  |
+-------------------+    +-------------------+
       |                        |
       v                        v
  Database A               Database B
  (optional cache)         (optional cache)
Components
User
client
Sends requests to the system
Load Balancer
load_balancer
Distributes user requests only to healthy microservices
Health Check Service
monitoring_service
Periodically checks health endpoints of microservices
Microservice A
service
Handles user requests and exposes health status
Microservice B
service
Handles user requests and exposes health status
Database A
database
Stores data for Microservice A
Database B
database
Stores data for Microservice B
Request Flow - 9 Hops
Health Check ServiceMicroservice A
Microservice AHealth Check Service
Health Check ServiceLoad Balancer
UserLoad Balancer
Load BalancerMicroservice A
Microservice ADatabase A
Database AMicroservice A
Microservice ALoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Microservice B
Impact:Load Balancer stops sending user requests to Microservice B, causing potential reduced capacity but no failed user requests to that service.
Mitigation:Health Check Service detects failure via failed health checks and informs Load Balancer to mark Microservice B as unhealthy. Traffic is routed only to healthy services.
Architecture Quiz - 3 Questions
Test your understanding
Which component decides if a microservice should receive user requests?
AHealth Check Service
BLoad Balancer
CDatabase
DUser
Design Principle
The health check pattern improves system reliability by continuously monitoring service health and preventing traffic from reaching unhealthy services. This reduces failed requests and helps maintain a smooth user experience.