The meaning of springcloud gateway

Application scenarios

1. North-south traffic

The traffic gateway and microservice gateway need to be used together to provide internal microservice capabilities with a unified HTTP access point to provide services to the outside world.

Traffic network management mainly performs load balancing on access traffic. The address and number of upstream microservice gateways have not changed much, and the requirements for service discovery are not high.

The microservice gateway maps external requests to internal microservices. The node addresses and numbers of microservices change frequently, and the changes in routing rules are basically stable. The microservice gateway conveniently solves service discovery.

2. East-west traffic

Microservice communication in the same business domain uses a service discovery mechanism. Load balancing of upstream nodes can be solved through robbin and Feign, and there is no need for a microservice gateway to provide centralized services.

In some systems with relatively large business volumes, a series of microservices may be isolated according to business domains. For example, two large business domain services, payment and transaction, can each be split into many fine-grained microservices. When accessing the business domain, it is hoped that services can be provided uniformly. It can be accessed in the north-south direction or in the east-west direction. When going in the east-west direction, it can use the microservice gateway.

comparison and future

The function of springcloud gateway is extremely weak. It only supports code and configuration files to configure routing rules. It does not support dynamic configuration of routing rules (you need to implement it yourself), which is not practical enough.

You can use any gateway like apisix to blast the spring cloud gateway. Dynamically defined routing rule configurations can take effect without restarting. Eureka service discovery has also been implemented long ago.

After installing kubenetes, I directly use service for service discovery. Not to mention gateway, I don’t even need Eureka.

In the long run, it is inevitable that k8s will be used in all applications, and springcloud gateway will inevitably decline.

Guess you like

Origin blog.csdn.net/zhangzhaokun/article/details/132882660