Skip to content

VIP7: Least connection director

Poul-Henning Kamp edited this page Apr 4, 2016 · 1 revision

Synopsis

I've recently moved from Varnish + HAProxy to Varnish only, to handle the cache + the load balancing with a single software. I'm pretty happy with it.

The only feature I've been missing from HAProxy is the leastconn load balancing algorithm. Their documentation describes it as:

for long connections, pick the least recently used of the servers with the lowest connection count

In some situations, this is preferable to round robin, for example when the number of open connections to a backend is directly related to its load (this is the case when the backend performs CPU-intensive tasks) and the workload is uneven across requests. In this case, round-robin might end up sending several small workloads to a backend server, and several big workloads to another.

The leastconn algorithm comes to the rescue by keeping the number of connections, and therefore the load, at a minimum on every server.

Would you consider adding a leastconn director to Varnish?

(Imported from ticket #1854)

Clone this wiki locally