zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    P4068 [SDOI2016]数字配对
    牛客挑战赛43 集合操作
    codefoces 1393D Rarity and New Dress
    codefoces 1400E Clear the Multiset
    [TJOI2017]城市 树形dp
    codefoces 1407E Egor in the Republic of Dagestan
    codefoces 1407D Discrete Centrifugal Jumps
    java保留两位小数(四舍五入和非四舍五入)
    JAVA在命令行进行输入输出重定向(JAVA SentinelValue)
    分治法(排列问题)
  • 原文地址:https://www.cnblogs.com/holoyong/p/9035758.html
Copyright © 2011-2022 走看看