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

ILoadBalancer of Ribbon

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Ribbon load balancing axis method, which aggregates IPing,IRule, ServerList, ServerListUpdater, ServerListFilter.

ILoadBalancer

Public interface ILoadBalancer {/ * * Initial list of servers. * This API also serves to add additional ones at a later time * The same logical server (host:port) could essentially be added multiple times * (helpful in cases where you want to give more "weightage" perhaps.) * * @ param newServers new servers to add * / public void addServers (List newServers); / * 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); / * To be called by the clients of the load balancer to notify that a Server is down * else, the LB will think its still Alive until the next Ping cycle-potentially * (assuming that the LB Impl does a ping) * * @ param server Server to mark as down * / public void markServerDown (Server server) / * deprecated 2016-01-20 This method is deprecated in favor of the * cleaner {@ link # getReachableServers} (equivalent to availableOnly=true) * and {@ link # getAllServers} API (equivalent to availableOnly=false). * * Get the current list of servers. * * @ param availableOnly if true, only live and available servers should be returned * / @ Deprecated public List getServerList (boolean availableOnly); / * @ return Only the servers that are up and reachable. * / public List getReachableServers (); / * * @ return All known servers, both reachable and unreachable. * / public List getAllServers ();}

AbstractLoadBalancer

Public abstract class AbstractLoadBalancer implements ILoadBalancer {public enum ServerGroup {ALL, STATUS_UP, STATUS_NOT_UP} / * delegate to {@ link # chooseServer (Object)} with parameter null. * / public Server chooseServer () {return chooseServer (null);} / * List of servers that this Loadbalancer knows about * * @ param serverGroup Servers grouped by status, e.g., {@ link ServerGroup#STATUS_UP} * / public abstract List getServerList (ServerGroup serverGroup); / * * Obtain LoadBalancer related Statistics * / public abstract LoadBalancerStats getLoadBalancerStats ();}

BaseLoadBalancer

Basically implements the interface used by ILoadBalancer.

DynamicServerListLoadBalancer

On BaseLoadBalancer, add additional features. The main purpose here is to implement the dynamic service list feature.

ZoneAwareLoadBalancer

On top of DynamicServerListLoadBalancer, additional features have been added. Configure multiple loadBalancer in zone form.

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