Ribbon自带负载均衡策略比较
生活随笔
收集整理的這篇文章主要介紹了
Ribbon自带负载均衡策略比较
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Ribbon自帶負載均衡策略比較
| 策略名 | 策略聲明 | 策略描述 | 實現說明 |
| BestAvailableRule | public class BestAvailableRule extends ClientConfigEnabledRoundRobinRule | 選擇一個最小的并發(fā)請求的server | 逐個考察Server,如果Server被tripped了,則忽略,在選擇其中ActiveRequestsCount最小的server |
| AvailabilityFilteringRule | public class AvailabilityFilteringRule extends PredicateBasedRule | 過濾掉那些因為一直連接失敗的被標記為circuit tripped的后端server,并過濾掉那些高并發(fā)的的后端server(active connections 超過配置的閾值) | 使用一個AvailabilityPredicate來包含過濾server的邏輯,其實就就是檢查status里記錄的各個server的運行狀態(tài) |
| WeightedResponseTimeRule | public class WeightedResponseTimeRule extends RoundRobinRule | 根據相應時間分配一個weight,相應時間越長,weight越小,被選中的可能性越低。 | 一個后臺線程定期的從status里面讀取評價響應時間,為每個server計算一個weight。Weight的計算也比較簡單responsetime 減去每個server自己平均的responsetime是server的權重。當剛開始運行,沒有形成statas時,使用roubine策略選擇server。 |
| RetryRule | public class RetryRule extends AbstractLoadBalancerRule | 對選定的負載均衡策略機上重試機制。 | 在一個配置時間段內當選擇server不成功,則一直嘗試使用subRule的方式選擇一個可用的server |
| RoundRobinRule | public class RoundRobinRule extends AbstractLoadBalancerRule | roundRobin方式輪詢選擇server | 輪詢index,選擇index對應位置的server |
| RandomRule | public class RandomRule extends AbstractLoadBalancerRule | 隨機選擇一個server | 在index上隨機,選擇index對應位置的server |
| ZoneAvoidanceRule | public class ZoneAvoidanceRule extends PredicateBasedRule | 復合判斷server所在區(qū)域的性能和server的可用性選擇server | 使用ZoneAvoidancePredicate和AvailabilityPredicate來判斷是否選擇某個server,前一個判斷判定一個zone的運行性能是否可用,剔除不可用的zone(的所有server),AvailabilityPredicate用于過濾掉連接數過多的Server。 |
?
Ribbon架構圖
?
參考資料
http://lxlong.iteye.com/blog/2314573
轉載于:https://www.cnblogs.com/zhangjianbin/p/7157709.html
總結
以上是生活随笔為你收集整理的Ribbon自带负载均衡策略比较的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux stm32 ide,一文教你
- 下一篇: hosts 文件与 ipv6