SpringCloud ------ Customize Ribbon load balancing strategy

In 1.Ribbon support load balancing strategy

Click on the toolbar "Navigate" -> "Type Hierarchy", the pop-up interface inheritance form

 

 

2. load balancing policy rules

RandomRule: randomly selecting a server (recommendation, when configuration as each Server) 

BestAvailabl: selecting a server minimal concurrent requests, one by one inspection Server, if the Server is tripped, is ignored 

RoundRobinRule: polling index, corresponding to the selected position index Server 

WeighedResponseTimeRule: If some strong Server, select

 

3. Modify application.yml profile

product- service: 
  Ribbon: 
    NFLoadBalancerRuleClassName: com.netflix.loadbalancer.RandomRule 



Note: 
Product - Application service name service calls for the current level of service, that 


the Spring: 
  the Application: 
    name: Product -service

 

Guess you like

Origin www.cnblogs.com/tianhengblogs/p/12466483.html