Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the core interface of Ribbon Loadbalance

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report