Gateway Aggregation pattern is similar with Gateway Routing but extra it is offering aggregation of services. Basically Gateway Aggregation pattern offers to use a gateway service that provide to aggregate multiple internal requests to internal microservices with exposing a single request to the client.
This pattern is should be used if client application have to invoke several different backend microservices to perform its logic.
Lets look at the image;
If we can’t put aggregation box here, The client sends requests to each service. Each service processes the request and sends the response back to the application (2,3,4,5,6).
So this will cause network problems and latency. And its not good to manage direct access services from the client and not good to invoke service responsibility to client.
To solve this problems, we can use a gateway to reduce chattiness between the client and the internal microservices. The gateway receives client requests, and dispatches requests to the several backend services, and then aggregates the results and sends them back to the requesting client.
This pattern can reduce the number of requests that the application makes to backend services, and improve application performance over high-latency networks.
See image that UI and MS communication are direct, and it seems hard to manage communications. We now we should focus on microservices communications with applying API GW pattern and evolving these architecture step by step.
Source: Medium - Mehmet Özkaya
The Tech Platform