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
  • 相关阅读:
    Vijos P1448 校门外的树【多解,线段树,树状数组,括号序列法+暴力优化】
    Vijos P1785 同学排序【模拟】
    Vijos P1784 数字统计【模拟】
    Vijos P1497 立体图【模拟】
    将你的wordpress博客添加到百度个性首页
    改变wordpress图片上传后的压缩质量
    优化dedecms设置文章url自定义规则
    dedecms首页调用随机文章全自动时时更新
    怎样在wordpress后台显示日志 ID
    sql批量修改wordpress文章发布时间
  • 原文地址:https://www.cnblogs.com/holoyong/p/9035758.html
Copyright © 2011-2022 走看看