envoyproxy/envoy

Custom upstream load-balancing service to return the upstream host

Open

#27.666 geöffnet am 29. Mai 2023

Auf GitHub ansehen
 (10 Kommentare) (1 Reaktion) (0 zugewiesene Personen)C++ (5.373 Forks)batch import
area/load balancingenhancementhelp wanted

Repository-Metriken

Stars
 (27.997 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 8T) (378 gemergte PRs in 30 T)

Beschreibung

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.

Contributor Guide