Consul: connect: Allow Load-balancing algorithm to be configured.

Created on 23 Sep 2019  路  5Comments  路  Source: hashicorp/consul

We current leave load balancing algorithm as the default (Round Robin) in Envoy. We should add support to configure this in proxy-defaults globally and per-service.

Envoy supports (docs):

  • (Weighted) Round Robin (default)
  • (Weighted) Least Load (Power of 2 choices)
  • Hash Ring
  • Random
  • Maglev

We should probably keep this opaque though so other proxies can attempt to match behaviour and default to something if they don't have an equivalent.

We should also look at some of the tuning configs for some of those algorithms to see if it makes sense to expose those too.

themconnect themenvoxds typenhancement

Most helpful comment

Anybody? The lack of this setting blocks us(and I think many others) from using Connect

All 5 comments

Envoy supports the following configuration (ref) that may be relevant:

  • lb_policy - one of Round Robin, Least Request, Ring Hash, Random, MagLev
  • common_lb_config - docs

    • currently we set this one of these, HealthyPanicThreshold: 0

    • these appear to be general settings, so maybe we don't need to expose these as part of this change?

    • use_hostname_for_hashing may be relevant for MagLev, and ring hash

  • ring_hash_lb_config (docs) - has 3 settings

    • minimum_ring_size, hash_function, maximum_ring_size

  • least_request_lb_config (docs) - has one setting choice_count
  • both MagLev and Ring Hash require that RouteAction.HashPolicy is set. It looks like that is not being set, so we would need to set this as well.

HAProxy config (ref) supports some of the same options, but is organized in a much different way:

  • roundrobin (dynamic or static)
  • least conn - seems to correspond to weighted least request
  • random
  • hash

    • rdp-cookie, hdr, url_param, uri, source - correspond roughly to the route action hash policy

    • hash-type

    • method - map-based, or consistent, envoy always uses consistent

    • function - corresponds to envoy ring_hash_lb_config.hash_function. There are 4 options, but they do not appear to overlap with the envoy options.

NGINX L7 config (ref):

  • round robin
  • least connections
  • random
  • hash

Any ideas when it will be ready? Maybe you want some help?

Can you also add query parameter hashpolicy option please?

Anybody? The lack of this setting blocks us(and I think many others) from using Connect

Hi @flyik, I can't provide a precise time estimate for when it will go out, but this enhancement is being picked back up now. It will either end up in a 1.8.x minor release or 1.9.0.

We will look into supporting query parameters as a hash policy along with request headers.

Was this page helpful?
0 / 5 - 0 ratings