Zuul (microservices gateway)
Different microservices generally have different network addresses, and external clients may need to call multiple service interfaces to fulfill a business requirement. For example, a mobile APP for movie ticket purchase may call multiple microservice interfaces to complete the ticket purchase business process. If the client directly communicates with each microservice, there will be the following problems:
(a) The client will request different microservices multiple times, increasing the complexity of the client.
(b) There are cross-domain requests, and the processing is relatively complicated in certain scenarios.
(c) Authentication is complex, requiring independent authentication for each service.
(d) Difficult to refactor. As the project iterates, microservices may need to be repartitioned. For example, it is possible to merge multiple services into one or to split one service into several. If clients communicate directly with microservices, refactoring will be difficult to implement.
(e) Some microservices may use protocols that are unfriendly to firewalls/browsers, making it difficult to access them directly.
The above problems can be solved by using the microservice gateway. The microservice gateway is an intermediate layer between the client and the server, and all external requests will first pass through the microservice gateway. After using the microservice gateway, the microservice gateway will encapsulate the internal structure of the application, and the client only needs to interact with the gateway without directly calling the interface of a specific microservice. In this way, development can be simplified. Not only that, but using a microservice gateway has the following advantages:
a) Ease of monitoring. Monitoring data can be collected at the microservice gateway and pushed to external systems for analysis.
(b) Ease of authentication. Authentication can be done on the microservice gateway before forwarding the request to the backend microservices without having to authenticate in each microservice.
(c) The number of interactions between clients and individual microservices is reduced.
Last updated