Envoy 集群管理 优先级调度和恐怖阈值
来源:原创
时间:2019-11-23
作者:脚本小站
分类:云原生
优先级调度:
超配因子:1.4
100 - ( 100 / 1.4 ) = 28.57% 凡是故障比例在这个之内的都由主优先级的节点来承载,当故障比例大于这个值时就会有流量向低优先级流转
例:
70%健康的 x 1.4 = 98% 主优先级节点承载百分之98%的流量
80%健康的 x 1.4 = 112% 主优先级节点承载百分之百流量
也就是健康比例 x 1.4 的结果如果大于百分之百不变,小于百分之百则向低优先级流转
当各个优先级的故障率加起来小于百分之百的情况下会重新分配流量。
30%*1.4 + 20%*1.4 + 10%*1.4 < 100% 这时候会按照3:2:1的比例重新分配流量,这些流量会分配给健康的端点。
降级端点:
在同一个优先级内部还可以划分优先级,调度方法同上,也是超配因子的方法。
Panic 阈值:恐慌阈值
当可用端点的百分比过低时,envoy将忽略所有端点的健康状态,并将流量调度给所有端点,这些流量会分配给健康的和非健康的端点。避免进入级联状态。
这个阈值就是panic阈值,默认为50%,当能够在低优先级的端点中找到承载所有流量的端点时则忽略panic阈值。
优先级定义方法:
endpoints: locality: 位置 lb_endpoints: 端点 load_balancing_weight: 权重 priority: 优先级,默认为0也是最高优先级
恐慌阈值:
Cluster.CommonLBConfig: healthy_panic_threshold: 50%,恐慌阈值 zone_aware_lb_config: locality_weighted_lb_config: update_merge_window: ignore_new_hosts_until_first_hc:
优先级示例:
admin: access_log_path: "/dev/null" address: socket_address: address: 0.0.0.0 port_value: 9901 static_resources: listeners: - address: socket_address: address: 0.0.0.0 port_value: 80 name: listener_http filter_chains: - filters: - name: envoy.http_connection_manager typed_config: "@type": type.googleapis.com/envoy.config.filter.network.http_connection_manager.v2.HttpConnectionManager codec_type: auto stat_prefix: ingress_http route_config: name: local_route virtual_hosts: - name: backend domains: - "*" routes: - match: prefix: "/" route: cluster: webcluster1 http_filters: - name: envoy.router clusters: - name: webcluster1 connect_timeout: 0.25s type: STRICT_DNS lb_policy: ROUND_ROBIN http2_protocol_options: {} load_assignment: cluster_name: webcluster1 policy: overprovisioning_factor: 140 endpoints: - locality: region: cn-north-1 priority: 0 lb_endpoints: - endpoint: address: socket_address: address: colorful port_value: 80 - locality: region: cn-north-2 priority: 1 lb_endpoints: - endpoint: address: socket_address: address: myservice port_value: 80 health_checks: - timeout: 5s interval: 10s unhealthy_threshold: 2 healthy_threshold: 1 http_health_check: path: /healthz expected_status: 200