Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use wasm to extend the load balance strategy? #225

Closed
mjaow opened this issue Dec 10, 2020 · 3 comments
Closed

Is it possible to use wasm to extend the load balance strategy? #225

mjaow opened this issue Dec 10, 2020 · 3 comments
Labels
question Further information is requested

Comments

@mjaow
Copy link

mjaow commented Dec 10, 2020

I don't want a rr load balance for gloo, but I found there is no way to customize it in gloo?

Have a look at wasm examples, all of them seem like do some filter/transform before request backend service. Is it possible to implement a customized load balance strategy with wasm?

just like

  1. user request
  2. jump into wasm, customize load balance and send dest name to header
  3. jump back to vs, with header, it will be routed directly to backend (gloo support header direction)
@mjaow mjaow added the question Further information is requested label Dec 10, 2020
@Sodman
Copy link
Member

Sodman commented Dec 10, 2020

Hi @mjaow, first - do any of the other non-rr Envoy load balancing strategies in Envoy work for you? This would be the easiest solution. https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/load_balancers#arch-overview-load-balancing-types

Next, in terms of Gloo Edge - you can route based on headers if you'd like, see our docs here on the various routing/matching patterns we support - https://docs.solo.io/gloo-edge/latest/guides/traffic_management/destination_selection/

If you want to use logic from a wasm filter from routing, Gloo Edge supports routing to a cluster as a header value, so you could have a wasm filter add the header for the cluster you wanted, then clear the route cache, and I believe gloo should forward the request to your desired cluster.

Otherwise, right now I don't believe your use case of a custom load balancing strategy is supported by the wasm ABI or the Envoy API. Here's a relevant discussion about extending load balancing strategies in upstream envoy - envoyproxy/envoy#5598

@mjaow
Copy link
Author

mjaow commented Dec 11, 2020

Yeah, for some reason, existing lb_policy of envoy is not able to support. We need a better global least request to make load even , envoy only support least req locally. Thanks for advice and the related link. I'll take a shot

@Sodman
Copy link
Member

Sodman commented Jan 18, 2021

Closing this as resolved for now, feel free to re-open if you have any more questions!

@Sodman Sodman closed this as completed Jan 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants