contour
contour copied to clipboard
What hashing strategy does Contour use in load balancing?
What question do you have?:
The documentation for load balancing mentions a RequestHash strategy. It then links to the Envoy documentation for more information about load balancing strategies. The problem is, that's not the name of an Envoy load balancing strategy. Envoy has two different request hashing load balancing strategies, which are drop in replacements for each other, Maglev and Ring hash. The contour docs don't say which is used, or how to select one if indeed you can select one or the other.
I think, at a bare minimum, if the Contour docs are going to delegate to the Envoy docs to understand load balancing strategies, the Contour docs should say which load balancing strategy in Envoy that RequestHash maps to. But, I think there should also be a mechanism in Contour to select which one gets used.
Hey @jroper, Contour uses ring hash, ref. https://github.com/projectcontour/contour/blob/056d8802b0815d0b35722c91a34b21c7f6b03e52/internal/envoy/v3/cluster.go#L244-L245.
Fair point on the docs, it would be good to clarify which strategy is being used in addition to linking to the Envoy docs for more background information. Would you care to contribute a fix?
Re: selecting between ring hash and maglev, that could certainly be considered as a feature. If you open a feature request issue specifically for that item, that will give folks a chance to comment. And again, if you are interested in contributing with design/implementation, that would likely be the fastest path towards moving this forward.