Endpoint steering 自定义每个 pool 如何向其关联 endpoint 分发请求。
这些分布是以下两个属性的组合:
创建 pool 时,必须为 Endpoint Steering 选择一个选项。
分配给 endpoint 的权重控制发送到该 endpoint 的 pool 流量百分比。默认情况下,pool 内所有 endpoint 的权重为 1。
如果每个 endpoint 保持默认设置并选择 Random(随机) endpoint 导向策略,每个 endpoint 将接收相同比例的流量。如果使用 Hash(哈希) 策略,该比例将根据请求的 IP 分布而变化。
创建或编辑 pool 时自定义权重,将 Weight 设置为 0 到 1 之间的数字(以 0.01 为增量)。Cloudflare 随后会根据 endpoint 导向策略和以下公式向该 pool 发送流量。
% of traffic to endpoint = endpoint weight ÷ sum of all weights in the poolEndpoint weight example
以下示例将权重应用于三个 endpoint,并使用 Random endpoint 导向策略:
- Weights: Endpoint A = 0.25;Endpoint B = 0.25;Endpoint C = 0.50
- 当所有 endpoint 健康时,每个 endpoint 将接收以下比例的总流量:A = 25%;B = 25%;C = 50%。
- 当一个 endpoint 不健康时(例如 endpoint C),每个健康 endpoint 将接收以下比例的总流量:A = 50%;B = 50%。
需要大量流量才能使分布收敛到预期值。
权重为 0 的 endpoint 不应接收发送到该 pool 的任何流量(但该 endpoint 仍会接收健康 monitor 请求)。
在仪表板中创建或编辑 pool 时,您也可以在 Percent(百分比) 字段中查看此值。
如果您为 Endpoint Steering(端点流量导向) 选择 Hash(哈希) 或启用会话亲和性,这些选项可能会影响流量分布。
此外,会话亲和性优先于任何选定的权重或 endpoint 导向策略。
使用 DNS-only load balancing 时,DNS 解析器可能会为客户端缓存已解析的 IP,从而影响流量分布。