負載平衡策略
可擴展的負載平衡策略可以針對每個叢集單獨設定,也可以透過呼叫API來設定。
開發人員可以使用 C++ 實作自定義的可設定策略。
以隨機負載平衡策略為例
name: example_cluster
type: STRICT_DNS
connect_timeout: 0.25s
load_assignment:
cluster_name: example_cluster
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: example.com
port_value: 80
load_balancing_policy:
policies:
- typed_extension_config:
name: envoy.load_balancing_policies.random
typed_config:
"@type": type.googleapis.com/envoy.extensions.load_balancing_policies.random.v3.Random