Weighted round robin with consul connect


we are using consul connect with envoy as sidecar proxy to connect our services platform. All our services run AWS Spot instances, so there is a mix of instances sizes serving the same service with different number of CPU and available RAM.

In order to send traffic to the service proportionally to the instance capacity for example based on number of CPUs we would like to configure weighted round robin in consul+envoy in a way that for example, the weight of each service instance is the number of CPUs that instance has.

  • 2 CPU: Weight 2
  • 4 CPU: Weight 4
    (this will allow us to be more efficient in terms of resources usage and also to be more consistent with the autoscaling policies)

Checking Consul documentation i came across https://www.consul.io/docs/discovery/services#dns-srv-weights that seems to reply with the weight when doing SRV DNS requests.
Does this setting also apply to the weighted round robin load balancing strategy that envoy supports? If not, is there any other way with consul+envoy to do this or is not posible at this moment.

Thanks you,

I’ve been debugging consul to find if it would work and it wont.

When querying by DNS, the result list are the services themselves with the configured weight for each service node.
But when using consul connect, the upstream resolution returns the list of sidecar proxies which dont have the weights configured and seems they have no way to configure it.
Would be nice to return the weights from the service they sidecar for so weights can apply also to consul connect.

Hi @radykal-com,

Thanks for filing the issue on GitHub to track this this feature request (https://github.com/hashicorp/consul/issues/9334) and submitting a PR to implement it (https://github.com/hashicorp/consul/pull/9335)! :tada:

Our team agrees this is a reasonable addition. We’ll continue corresponding with you about this on the PR.