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
  • 相关阅读:
    ios 中的循环引用问题及解决
    Leetcode-Maximum Depth of Binary Tree
    Leetcode-Min Stack
    Leetcode-Intersection of Two Linked Lists
    Leetcode-Binary Tree Inorder Traversal
    Leetcode-Unique Binary Search Trees II
    Leetcode-Unique Binary Search Trees
    Leetcode-binary Tree Zigzag Level Order Traversal
    Leetcode-Construct Binary Tree from inorder and preorder travesal
    Leetcode-Next Permutation
  • 原文地址:https://www.cnblogs.com/holoyong/p/9035758.html
Copyright © 2011-2022 走看看