0
0
Microservicessystem_design~12 mins

Request aggregation in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Request aggregation

This system collects data from multiple microservices and combines the results into a single response for the user. It is designed to improve user experience by reducing the number of separate requests the user must make and to handle data aggregation efficiently.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway
  |
  v
Aggregator Service
 /      |       \
v       v        v
Service A  Service B  Service C
  |         |         |
  v         v         v
Database A Database B Database C
  \
   v
  Cache
Components
User
client
Initiates requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly across API Gateway instances
API Gateway
api_gateway
Receives user requests and routes them to the Aggregator Service
Aggregator Service
service
Sends parallel requests to multiple microservices and combines their responses
Service A
service
Handles specific domain logic and data retrieval from Database A
Service B
service
Handles specific domain logic and data retrieval from Database B
Service C
service
Handles specific domain logic and data retrieval from Database C
Database A
database
Stores data for Service A
Database B
database
Stores data for Service B
Database C
database
Stores data for Service C
Cache
cache
Stores frequently accessed aggregated data to reduce latency
Request Flow - 21 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayAggregator Service
Aggregator ServiceCache
CacheAggregator Service
Aggregator ServiceService A
Aggregator ServiceService B
Aggregator ServiceService C
Service ADatabase A
Service BDatabase B
Service CDatabase C
Database AService A
Database BService B
Database CService C
Service AAggregator Service
Service BAggregator Service
Service CAggregator Service
Aggregator ServiceCache
Aggregator ServiceAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:Cache
Impact:Aggregator Service cannot retrieve cached aggregated data, causing all requests to fetch data from microservices and databases, increasing latency.
Mitigation:System continues working by fetching fresh data from services and databases; cache can be restored asynchronously. Optionally, implement cache replication or fallback caches.
Architecture Quiz - 3 Questions
Test your understanding
Which component is responsible for combining data from multiple microservices?
ALoad Balancer
BAPI Gateway
CAggregator Service
DCache
Design Principle
This architecture demonstrates the principle of request aggregation by centralizing multiple service calls into one. It improves performance by using caching and parallel service calls, reducing user wait time and system load.