A brief introduction of the gateway Zuul
The following describes from ☞ Detailed Spring Cloud Zuul service gateway and use Zuul build API Gateway
Benpian not too in-depth introduction. Features / performance test engineers need to know gateway services can be developed, then you need to understand.
I. Background and Introduction to Micro Services Gateway
Different micro-services in general have different network addresses, and external clients may need to call multiple service interfaces to complete a business needs. For example, a movie ticket collection APP, micro film classification may call back services, users micro-service, micro-payment services. If the client and micro service to communicate directly, there will be the following questions:
- The client repeatedly requested different micro-services, increase the complexity of the client
- Cross-domain request processing at a certain scene is relatively complex
- Certification complex, each service requires a separate certification
- Difficult to reconstruct, with the iteration of the project may need to be re-divided micro service, if the client directly and micro-service communication, then the reconstruction will be difficult to implement
- Some micro services may use other protocols, direct access will be difficult
The above-mentioned problems can be solved by means of micro-service network management. Micro-services network is interposed an intermediate layer between the client and the server, all requests will go through the external micro serving gateway architecture evolved to:
Two, Zuul Profile
Zuul is open source Netflix micro-services gateway,Zuul Netflix is produced based on a JVM routing and server load balancer. It can Eureka, Ribbon, Hystrix use with other components. Zuul core component is a series of filters, these filters can perform the following functions:
- Authentication and security: identification verification requirements for each resource, and reject those that do not match the request
- Review and Monitoring:
- Dynamic Routing: dynamic route requests to different backend cluster
- Stress Test: gradually increase traffic to the cluster to understand the performance
- Load distribution: corresponding to the load capacity for each type of distribution, and discards the request exceeds the limit value
- Static response processing: edge position to respond, to avoid forwarded to the cluster.
- Multi-regional flexibility: Cross-domain routing request AWS Region designed to achieve ELB (ElasticLoad Balancing) use diversification
Third, what is the gateway? Why do I need to use Gateway?
By drawing on the services provided externally, in the absence of gateway situation, API service interfaces directly exposed to the caller , the caller increased when, callers of different services vary, it is bound to add customized access privileges such as checking logic . When adding API Gateway, and then a third-party call between the terminal and the service provider to create a wall, this wall permissions control directly communicate with the caller, after requesting a balanced distribution to end back-office services, as without direct access to compute -service add method, but by api-a / add link passes the request to the service instance .Zuul is to provide load balancing - reverse proxy - certification authority of such an API gateway.
Nginx is similar to adding a wall of protection wall in the forefront of application services, zuul load balancing is for dispatches requests to a service station or a service instance in the cluster. The ribbon is also the main service load function, it is a service for consumers to call to request a specific distribution service provided examples. Both do load balancing, actually is on a different system levels.
Well, here briefly over ~