Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

What is the core interface of Ribbon Loadbalance

Shulou Source: shulou.com Published: 2022-06-02 01:56:38 10月05日 Update

What is the core interface of Ribbon Loadbalance, many novices are not very clear about this. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something.

Ribbon Loadbalance Core Interface list

IRule

ILoadBalancer

ServerList

ServerListFilter

IPing

Function introduction

Configuration Portal: RibbonClientConfiguration

Select the right node in the right way

ILoadBalancer

API definition: com.netflix.loadbalancer.ILoadBalancer

Core method:

/ * Choose a server from load balancer. * * @ param key An object that the load balancer may use to determine which server to return. Null if * the load balancer does not use this parameter. * @ return server chosen * / public Server chooseServer (Object key); / * * @ return Only the servers that are up and reachable. * / public List getReachableServers (); / * * @ return All known servers, both reachable and unreachable. * / public List getAllServers ()

Core role: maintain full service list and available list, rely on IPing interface to mark failure nodes, identify failure depends on IPing implementation

Default implementation: ZoneAwareLoadBalancer

IRule

API definition: com.netflix.loadbalancer.IRule

Core method:

/ * choose one alive server from lb.allServers or * lb.upServers according to key * * @ return choosen Server object. NULL is returned if none * server is available * / public Server choose (Object key)

Core role: select a server; from loadbalance to provide multiple selection strategies

Default implementation: ZoneAvoidanceRule

ServerList

API definition: com.netflix.loadbalancer.ServerList

Core method:

/ * Return updated list of servers. This is called say every 30 secs * (configurable) by the Loadbalancer's Ping cycle * * / public List getUpdatedListOfServers ()

Core role: get the list of update services

Default implementation: ConfigurationBasedServerList

ServerListFilter

API definition: com.netflix.loadbalancer.ServerListFilter

Core method:

Public List getFilteredListOfServers (List servers)

Core role:

Default implementation: ZonePreferenceServerListFilter

IPing

API definition: com.netflix.loadbalancer.IPing

Core method:

/ * * Checks whether the given Server is "alive" i.e. Should be * considered a candidate while loadbalancing * * / public boolean isAlive (Server server)

Core role: check whether a specific service is alive or not, and do failure service detection in ILoadBalance

Default implementation: DummyPing

Extended thinking

The biggest point of Ribbon is that it allows users to customize various rules, manages node state and access rules well, and makes some useful products based on rule extension, such as grayscale management and weight control under unequal capabilities of target nodes.

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

Tags: Core interface function method node service rule appropriate help detection management selection maximum clear product entry content function variety for this Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Information MySQL OPPO Reno Linux