SpringCloud Common Components

spring cloud has five core components Eureka, Ribbon, Feign, Hystrix, Zuul, simply recorded as follows.

  • Eureka is a micro-service architecture in the registry, responsible for registration and discovery services. Eureka Client components dedicated to the service information registered in Eureka Server, whereas Eureka Server is a registration center, which has a registry, save the machine and port number for each service is located. When each service starts, Eureka Client service will be registered with the Eureka Server, and Eureka Client can in turn pull registry from Eureka Server, so they know where other services.
  • Feign key mechanism is the use of dynamic proxy. If you define an interface @FeignClient for comment, Feign this interface will create a dynamic proxy for; then if you call that interface, essentially calls the dynamic proxy Feign created; Feign dynamic proxy interface according to your will the @RequestMapping and other annotations to dynamically construct address of the service you want to request; for this address initiates a request, parse the corresponding;
  • Ribbon is the role of load balancing, it will help you choose a machine on every request, even to request circulated to each machine, using Round Robin Round Robin default;
  • Hystrix is ​​isolated, and a frame fuse degraded. Request is initiated by Hystrix thread pool to go, different services take a different thread pool to achieve the isolation of different service calls, to avoid the avalanche of service issues;
  • Zuul is micro-services gateway. This component is responsible for routing network, the general micro-services architecture design necessarily a gateway on the inside, like android, ios, pc front-end, small micro-channel program, h5, etc., do not care about the back-end services have hundreds, you know there is a gateway, all requests go to the gateway, the gateway at the request of some of the features of each service will forward the request to the backend. After a gateway, there are many benefits, such as making a unified downgrade, current limiting, authentication and authorization, security and so on.

Spring Cloud following five core components are connected in series by a FIG:
Here Insert Picture Description

Ribbon and Feign Eureka and close cooperation, to complete the work, as follows:

    • First Ribbon will get from Eureka Client in the corresponding service registry, will know all the services which are deployed on the machine, listening on which port numbers;
    • Then you can use the default Ribbon Round Robin algorithm, choose a machine;
    • Feign would be focused on this machine, constructed and initiated the request

Guess you like

Origin www.cnblogs.com/whymoney1000/p/11242087.html