envoyproxy/envoy

Custom upstream load-balancing service to return the upstream host

Open

#27,666 创建于 2023年5月29日

在 GitHub 查看
 (10 评论) (1 反应) (0 负责人)C++ (5,373 fork)batch import
area/load balancingenhancementhelp wanted

仓库指标

Star
 (27,997 star)
PR 合并指标
 (平均合并 8天) (30 天内合并 378 个 PR)

描述

Title: Custom upstream load-balancing service

Description: We have a requirement to select the upstream host based on the custom load balancing parameters. With the current Envoy proxy load balancing support, it is only possible by updating the Envoy configuration.

While going through the envoy load balancer handling, I came across overrideHostToSelect, which is returned when the http router filter is invoked, and envoy proxy sends the request to the overridden host.

/**

  • Returns the host the load balancer should select directly. If the expected host exists and    * the host can be selected directly, the load balancer can bypass the load balancing algorithm.    * and return the corresponding host directly.    */   virtual absl::optional overrideHostToSelect() const PURE;

Proposed Solution: Add a new "custom load balancer" http filter that will be invoked before the router filter. The "custom load balancer" http filter configuration will expect the "customer LB" service endpoint. The custom LB service will return the upstream host. The HTTP filter in turn will override the upstream host with the host returned by the "custom LB service". If the "custom LB" service doesn't return any hosts, then the existing cluster LB algorithm will be kicked in to select the appropriate host.

贡献者指南