Gateway Aggregation Pattern
In this tutorial, we are going to discuss Design Patterns of Microservices architecture which is the Gateway Aggregation Pattern. We will use this pattern and practice when designing microservice architecture.
Gateway Aggregation Pattern is similar to the Gateway Routing but extra it is offering aggregation of services. Basically, the Gateway Aggregation pattern offers to use a gateway service that provides to aggregates multiple internal requests to internal microservices with exposing a single request to the client.
This pattern is should be used if the client application has to invoke several different backend microservices to perform its logic. Let’s look at the image;
If we can’t put an 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 it’s not good to manage direct access services from the client and not good to invoke service responsibility to the client.
To solve these problems, we can use a gateway to reduce chattiness between the client and the internal microservices. The gateway receives client requests, dispatches requests to 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.