In the back-end separation architecture, the service layer is split into many services that need to exchange communications.

For example, if service A wants to call service B, service A will get the address and port of service B from the registry and then request service B.

process

Ribbon

introduce

The Ribbon is an open source load balancer based on HTTP and TCP. Flow chart:

Load balancing algorithm: polling, random, weighted rotation, weighted random, address hashing, etc.

Spring Cloud introduces ribbon and restTemplate to achieve client load balancing. There are many remote call technologies in Java, such as WebService, Socket, RMI, Apache HttpClient, OkHttp, etc. Internet projects use more CLIENTS based on HTTP.

Feign is introduced

Spring Cloud introduces Feign and integrates the Ribbon for client-side load balancing calls.

The @feignClient is used to configure the service name. Once configured, he will find the service based on the service name.