45
CHAPTER 3 | Architecting container and microservice-based applications
For more information, see
Gateway routing pattern
.
Requests aggregation.
As part of the gateway pattern you can aggregate multiple client requests
(usually HTTP requests) targeting multiple internal microservices into a single client request. This
pattern is especially convenient when a client page/screen needs information from several
microservices. With this approach, the client app sends a single request to the API Gateway that
dispatches several requests to the internal microservices and then aggregates the results and sends
everything back to the client app. The main benefit and goal of this design pattern is to reduce
chattiness between the client apps and the backend API, which is especially important for remote
apps out of the datacenter where the microservices live, like mobile apps or requests coming from
SPA apps that come from JavaScript in client remote browsers. For regular web apps performing the
requests in the server environment (like an ASP.NET Core MVC web app), this pattern is not so
important as the latency is very much smaller than for remote client apps.
Depending on the API Gateway product you use, it might be able to perform this aggregation.
However, in many cases it’s more flexible to create aggregation microservices under the scope of the
API Gateway, so you define the aggregation in code (that is, C# code):
For more information, see
Gateway aggregation pattern
.
Dostları ilə paylaş: