![]() If that consumption is performed directly, the client needs to handle multiple calls to microservice endpoints. In a microservices architecture, the client apps usually need to consume functionality from more than one microservice. Why consider API Gateways instead of direct client-to-microservice communication Again, a facade or API in between the mobile app and the microservices can be convenient for this scenario. And, of course, you might compress that data. You might do this functionality by aggregating data from multiple microservices and returning a single set of data, and sometimes eliminating any data in the response that isn't needed by the mobile app. For mobile apps, you might need to optimize even further so that data responses can be more efficient. For instance, the needs of a mobile app might be different than the needs of a web app. The API of multiple microservices might not be well designed for the needs of different client applications. How can you shape a facade especially made for mobile apps?.A man-in-the-middle approach can help in this situation. Therefore, requests must be performed through protocols like HTTP/HTTPS and translated to the other protocols afterwards. Protocols used on the server side (like AMQP or binary protocols) are not supported in client apps. How can client apps communicate with services that use non-Internet-friendly protocols?.A possible approach is to have those services within the Docker host or internal cluster to restrict direct access to them from the outside, and to implement those cross-cutting concerns in a centralized place, like an API Gateway. Implementing security and cross-cutting concerns like security and authorization on every microservice can require significant development effort. How can you handle cross-cutting concerns such as authorization, data transformations, and dynamic request dispatching?.This approach reduces latency, since multiple pieces of data come back in parallel and some UI can show data as soon as it's ready. Ideally, responses should be efficiently aggregated in the server side. This approach increases latency and complexity on the UI side. Interacting with multiple microservices to build a single UI screen increases the number of round trips across the Internet. How can client apps minimize the number of requests to the back end and reduce chatty communication to multiple microservices?.However, when you build large and complex microservice-based applications (for example, when handling dozens of microservice types), and especially when the client apps are remote mobile apps or SPA web applications, that approach faces a few issues.Ĭonsider the following questions when developing a large application based on microservices: ![]() ![]() In any case, a load balancer and ADC are transparent from a logical application architecture point of view.Ī direct client-to-microservice communication architecture could be good enough for a small microservice-based application, especially if the client app is a server-side web application like an ASP.NET MVC app. This approach improves the load of your hosts by offloading CPU-intensive SSL termination and other routing duties to the Azure Application Gateway. This layer acts as a transparent tier that not only performs load balancing, but secures your services by offering SSL termination. In production environments, you could have an Application Delivery Controller (ADC) like Azure Application Gateway between your microservices and the Internet. In a production environment based on a cluster, that URL would map to the load balancer used in the cluster, which in turn distributes the requests across the microservices. An example of a URL for a particular service could be the following URL in Azure: In this approach, each microservice has a public endpoint, sometimes with a different TCP port for each microservice. Using a direct client-to-microservice communication architecture In this approach, a client app can make requests directly to some of the microservices, as shown in Figure 4-12.įigure 4-12. Direct client-to-microservice communicationĪ possible approach is to use a direct client-to-microservice communication architecture. This fact can impact the client-to-microservice communication, as explained in this section. In a microservices architecture, each microservice exposes a set of (typically) fine-grained endpoints.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |