0
0
Microservicessystem_design~12 mins

Why API gateways unify service access in Microservices - Architecture Impact

Choose your learning style9 modes available
System Overview - Why API gateways unify service access

This system shows how an API Gateway acts as a single entry point for multiple microservices. It simplifies client access by unifying requests, handling routing, security, and load balancing. This helps keep services independent and scalable while providing a smooth experience for users.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |        |        |
  v        v        v
Service A Service B Service C
  |        |        |
  v        v        v
Database Database Database
  
Cache Cache Cache
Components
User
client
Initiates requests to the system
Load Balancer
load_balancer
Distributes incoming traffic evenly to API Gateway instances
API Gateway
api_gateway
Unifies access to multiple microservices, handles routing, authentication, and request aggregation
Service A
service
Handles specific business logic A
Service B
service
Handles specific business logic B
Service C
service
Handles specific business logic C
Database
database
Stores persistent data for each service
Cache
cache
Speeds up data retrieval for each service
Request Flow - 10 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayService A / Service B / Service C
Service A / Service B / Service CCache
CacheService A / Service B / Service C
Service A / Service B / Service CDatabase
DatabaseService A / Service B / Service C
Service A / Service B / Service CAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:API Gateway
Impact:Users cannot access any microservices because the unified entry point is down
Mitigation:Deploy multiple API Gateway instances behind the load balancer for redundancy; use health checks to route traffic only to healthy gateways
Architecture Quiz - 3 Questions
Test your understanding
What is the main role of the API Gateway in this architecture?
ATo balance load between databases
BTo store user data persistently
CTo unify access and route requests to microservices
DTo cache data for faster access
Design Principle
Using an API Gateway centralizes and simplifies client access to multiple microservices. It handles routing, security, and load balancing, allowing services to remain independent and scalable while providing a unified interface to users.