Ribbon负载均衡接口

IRule——负载均衡规则

1.RounRobinRule:轮询负载均衡,通过累加取余获取服务,默认规则

2.RandomRule:随机负载均衡

3.WeightedResponseTimeRule:根据响应时间进行加权轮询

4.RetryRule:在一定的时间内使用指定的规则获取可用的服务

5.BestAvailableRule:过滤掉断路的服务,获取请求量最小的服务

6.AvailabilityFilteringRule:过滤掉断路服务和超过active connections配置的服务

IPing——心跳机制

1.NoOpPing、DummyPing:不进行操作直接返回true

2.PingConstant:返回默认值

3.PingUrl:通过请求指定url判断服务是否存活

4.NIWSDiscoveryPing:与eureka集成,通过判断eureka的instanceInfo判断服务状态

ILoadBalancer——负载均衡核心接口

1.NoOpLoadBalancer:默认接口返回null

2.BaseLoadBalancer:基础负载均衡,集成IRule、IPing,将负载均衡服务委托给IRule,通过定时器每10s使用IPing检测服务状态。

3.DynamicServerListLoadBalancer:在BaseLoadBalancer的基础上,集成ServerListUpdater动态更新Server集合,集成ServerListFilter过滤服务。

ServerListUpdater——服务列表更新器

1.PollingServerListUpdater:定时调用ServerListUpdater.UpdateAction方法更新列表

2.EurekaNotificationServerListUpdater:通过订阅eureka的CacheRefreshedEvent事件更新列表

posted @ 2020-06-09 11:15  wuweishuo  阅读(474)  评论(0)    收藏  举报