Small D Class - New version of the micro-services springcloud + Docker tutorial _4-03 advanced load balancing length of the Ribbon actual source code analysis

notes

3, advanced load balancing length of the Ribbon actual source code analysis
    Introduction: explain the call load balancing between source code analysis service ribbon
        1, perfect under a single interface to
        2, analysis @LoadBalanced
            1) First, get a list from the registry provider
            2) by selecting a certain strategy wherein a node
            3) back to the calling restTemplate

Start

Order to obtain inside information about the products, replaced here Map to accept.

In this map which you can get the name and price

starting order of service test

Analysis ribbon

Why is better than http.
See the official document


search keywords ribbon

another load balanced way







address to get services + port number

new a restTemplate. Then pass inside the url address

to use in this way also can get data of



each port is not the same

Analysis ribbon

First find the entrance
@LoadBalanced notes



go search LoadBalacnerClient

see his subclasses



here added a breakpoint. Restart repeat. Access interface address



polling strategy


getAllServers get a list of services, access to the three.

Get the 8773 node




 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11443972.html