SpringCloudGateway, zuul service gateway research overview

Gateway Technology Comparison

cloud-netflix-zuul(zuul 1.x) Spring Cloud Gateway Zuul 2.x
cloud-netflix-zuul(zuul 1.x) Spring Cloud Gateway Zuul 2.x
Maintenance & Community Stop updating, maintain status, Spring community is active, official documents are too few Continuous, active community, both Chinese and English documents The information is limited, basically in Netflix official, English documents
ecology Cloud ecology, the new version no longer supports (only Eureka remains) Cloud ecology is not limited to Netflix. Component integration support is more convenient Does not support Cloud ecology, Netflix native components support
availability Cluster deployment + registration center Cluster deployment + registration center
support function Current limiting, circuit breaking, retrying, load balancing (requires integration of related components) Groovy dynamic loading Filter monitoring (actuator) Built-in: route rewriting, current limiting, circuit breaker, more flexible dynamic routing (assert any content of Request, filter can be global or local routing) more flexible grayscale monitoring (actuator) Core Features Netty Connection Pool Management Adaptive Retry, Request Try, etc. Groovy Dynamic Loading Filter
does not support function Long connection, websocket route rewriting dynamic route needs to monitor Apollo configuration refresh grayscale (eureka metedata marking + filter) Dynamic routing needs to monitor Apollo configuration refresh Token Bucket Current Limit Routing Rewrite
ease of use easy to use Easy to use ( official built-in filters, many assertions, high out-of-the-box usability ) There is difficulty in Spring integration, and the use is not flexible enough
Scalability Filter: pre, post, route, error applications need to pass code predicate, filter (global) = custom configuration custom predicate, filter can be applied in the configuration file or configuration center through the name prefix Filter(sync & asnyc):incoming、endpoint、outgoing
management interface Spring Boot Admin can only view (access actuator port) Spring Boot Admin (connected to the actuator port) supports limited query and modification, see below for details
Corporate Infrastructure Support compatible Based on Spring Framework 5.0 & Boot 2.x. The company's infrastructure is based on Boot 1.5, and Framework 4.x cannot be used directly. Simple use can ignore the compatibility of related components. Otherwise, under the premise of infrastructure, research costs are required. It is not compatible with the Spring Cloud system and requires development costs.

Spring Boot Admin dynamic routing

The support for routing query and modification itself is based on the actuator interface ( Spring Cloud Gateway ) provided by Spring Cloud Gateway .

image2021-11-29_15-26-32.png
It can be used simply, but the disadvantages are also very detailed:

  • Low severity: usage syntax is Json, not as straightforward as configuration usage

  • Low severity: only gateway-related functions are used, and only the routing-related actuator interface of the gateway service needs to be opened

  • Moderate severity: In terms of user experience, it supports simple use. General viewing and operating experience

  • Moderate severity: no versioning, no way to roll back or view historical routes.

  • Moderate severity: The routes of the configuration and registry cannot be modified or deleted. Only the routes added in the Admin interface can be deleted (cannot be modified, delete first and then add).

  • High severity: Routes added in Admin are usually stored in memory, and will be lost after restarting.

  • High severity: Unable to publish routing changes to all instances with one click, only one instance can be changed in a single operation

image2021-11-29_15-54-20.png

Scalability:

  • Data source can be changed: extended route data source acquisition classRouteDefinitionRepository,从可靠数据源中获取
  • Modify the original actuator update interface, and write the new route into the data source. (Whether it is feasible to be verified, for the record: add a new interface, but the admin front end needs to be changed)
  • Route refresh messages are propagated to all instances:
    • Related message component support
    • The instance monitors data source changes (the database can be used for regular query in the short term, and the data source with monitoring function similar to Redis can be used in the long term, and the database is fully covered)
    • The front end notifies all instances (not a big deal)

Appendix 1: Gateway Version

Supported versions: Spring Framework 5.x, SpringBoot 2.x and above

img

reference

Spring Cloud Gateway

Spring Cloud Netflix Zuul

Home · Netflix/zuul Wiki · GitHub

Guess you like

Origin blog.csdn.net/jiangxiayouyu/article/details/122369771