• netflix-ribbon简介


    常用的三种负载均衡规则

    RoundRobinRule(简单轮询)

    这条规则简单地通过循环法选择服务器。它通常用作默认规则或更高级规则的后备规则。

    AvailabilityFilteringRule(可用性过滤)

    当连接失败次数达到一定阈值或某连接的并发量达到一定阈值时,认为该远端server不可用,client会在一定时间间隔后再次尝试连接,并且该间隔按指数增长。

    # successive connection failures threshold to put the server in circuit tripped state, default 3
    niws.loadbalancer.<clientName>.connectionFailureCountThreshold
    
    # Maximal period that an instance can remain in "unusable" state regardless of the exponential increase, default 30
    niws.loadbalancer.<clientName>.circuitTripMaxTimeoutSeconds
    
    # threshold of concurrent connections count to skip the server, default is Integer.MAX_INT
    <clientName>.<clientConfigNameSpace>.ActiveConnectionsLimit

    WeightedResponseTimeRule

    客户端记录每个服务器的平均响应时间,并赋予权重,响应时间越长,重量就越小。

    <clientName>.<clientConfigNameSpace>.NFLoadBalancerRuleClassName=com.netflix.loadbalancer.WeightedResponseTimeRule

    ServerListFilter

    ZoneAffinityServerListFilter

    筛选出与客户端不在同一区域中的服务器,除非客户端区域中没有可用的服务器,zone在client和server都需要配置。

    myclient.ribbon.EnableZoneAffinity=true

    ServerListSubsetFilter

    该过滤器确保客户端只能看到由ServerList实现返回的整个服务器的固定子集,可以周期性用新服务器替换可用性不佳的服务器。

    myClient.ribbon.NIWSServerListClassName=com.netflix.niws.loadbalancer.DiscoveryEnabledNIWSServerList 
    # the server must register itself with Eureka server with VipAddress "myservice"
    myClient.ribbon.DeploymentContextBasedVipAddresses=myservice
    myClient.ribbon.NIWSServerListFilterClassName=com.netflix.loadbalancer.ServerListSubsetFilter
    # only show client 5 servers. default is 20.
    myClient.ribbon.ServerListSubsetFilter.size=5
  • 相关阅读:
    windows2012 永激活及配置
    Fiddler2 英文版翻译
    你知道using的用法吗?
    你会利用css写下拉列表框吗?
    完美解决.net2.0和.net4.0在同一个iis中共同运行
    深入剖析new override和virtual关键字
    思科防火墙,h3c三层交换机配置笔记
    c# 笔记 数据类型转换 数组 函数
    Silverlight 完美征程 笔记1 (控件模型)
    C#笔记(流程控制)
  • 原文地址:https://www.cnblogs.com/holoyong/p/9035758.html
Copyright © 2020-2023  润新知