Hi Dan!

> The documentation for leastconn says "The server with the lowest
> number of connections receives the connection" -- does this mean a new
> HTTP connection, or a new request on an existing connection (e.g. with
> HTTP keep-alive)?
>
> In our use case, we have a relatively small (a few thousand) number of
> very long lived keep-alive sessions (100s of requests per second per
> connection), so the distinction is very important for us. It's not
> important that subsequent requests on a keep-alive session go to the
> same backend node that the previous ones did, each request is
> independent.
>
> Actually, for that matter, I have the same question about roundrobin
> and static-rr -- do they balance connections or requests? And, if the
> former, is there a way to make HAProxy balance requests rather than
> connections?

I would say this simple depends on the http mode you use.

When you use tunnel mode (default in pre-1.5 releases), it obviously
sticks to the same backend server. When you use close mode, both
server and client connections are closed after the response (no
keepalive).

Instead, for your environment you should use http-server-close:
http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#option%20http-server-close


This way, frontend keeps doing keepalive with your clients, maintaining
long-lived sessions, while your backend closes the connection after
the response, thus, leastconn works for every single requests.



Regards,

Lukas

                                          

Reply via email to