0
0
Microservicessystem_design~12 mins

Service discovery concept in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Service discovery concept

This system enables microservices to find and communicate with each other automatically. It handles dynamic changes like services starting, stopping, or moving, ensuring requests reach the right service instance without manual configuration.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
+-------------------+
| Service Discovery  |
| (Registry + Client)|
+-------------------+
  |           |
  v           v
Service A   Service B
  |           |
  v           v
Database    Cache
Components
User
client
Initiates requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Receives client requests and routes them to appropriate services using service discovery
Service Discovery
service_registry
Keeps track of available service instances and their locations
Service A
service
Handles specific business logic and registers itself with service discovery
Service B
service
Handles another business domain and registers itself with service discovery
Database
database
Stores persistent data for services
Cache
cache
Speeds up data retrieval for services
Request Flow - 12 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayService Discovery
Service DiscoveryAPI Gateway
API GatewayService A
Service ACache
CacheService A
Service ADatabase
DatabaseService A
Service AAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Service Discovery
Impact:API Gateway cannot find service instances, so requests fail or are delayed
Mitigation:Use replicated service registry instances and client-side caching of service info to reduce impact
Architecture Quiz - 3 Questions
Test your understanding
Which component helps the API Gateway find the current location of a service?
AService Discovery
BLoad Balancer
CCache
DDatabase
Design Principle
This architecture shows how service discovery enables dynamic and scalable microservices communication by decoupling service location from clients. It improves flexibility and fault tolerance by allowing services to register and deregister themselves automatically.