As to `balance leastconn`, I don't know if it's recommended but it's what I normally use. My backends are often not equal (some have more horsepower (different model physical servers, different loads from vms running on them, etc), some higher latency because of different cities), etc... and leastconn seems like that should do the best in balancing unequal backends, automatically giving those that respond the fastest the most load. It would be interesting to see those benchmarks if they set different resource capabilities on those backends and see how they compare. Sometimes you can know and use weight, but if that's all dynamic and you don't always know....
On Wed, Mar 12, 2025 at 6:55 PM Aleksandar Lazic <al-hapr...@none.at> wrote: > > Hi. > > In the doc is this text. > > https://docs.haproxy.org/3.1/configuration.html#4-balance > > ``` > #snip > > leastconn The server with the lowest number of connections receives the > connection. Round-robin is performed within groups of servers > of the same load to ensure that all servers will be used. Use > of this algorithm is recommended where very long sessions are > expected, such as LDAP, SQL, TSE, etc... but is not very well > suited for protocols using short sessions such as HTTP. <more> > ``` > > But when I take a look into that Benchmark would I say that leastconn > outperforms the other algorithms. > > https://www.haproxy.com/blog/power-of-two-load-balancing > > That's now the question: > > Is `balance leastconn` still not recommend for http workload? > > Regards > Alex > >