Hi Tamara,

On 16/06/2025 14:52, Boehm, Tamara wrote:

Thank you very much for your response.

It's interesting to learn that round-robin is considered a non-deterministic algorithm. We assumed it was deterministic because of its definition that requests are sent to the next backend/server one after the other.During our experiments with HAProxy 2.8.14, we could observe that this option has an impact on the load balancing.

Is it possible to improve theHAProxy documentation by clarifying which algorithms are deterministic and which are not?

Ok, thanks this will be added and backported to the docs.

We have afurther question regarding the http-keep-alive(https://www.haproxy.com/documentation/haproxy-configuration-manual/2-8r1/#4.2-option%20http-keep-alive) property. The documentation states it's enabled by default. If the client sends a request with the "Connection: Close" header, will HAProxy close the connection to the backend or keep it idle?

From what I see with the oneliner below and a simple backend (nginx serves static file), two connections to the backend (haproxy -> server and server -> haproxy) stay idle for some short time, i.e. ~15s after the last request with "Connection:close" header was served.

option http-keep-alive or no-option http-keep-alive does not change the behaviour and the same if we do not have "Connection: close" in the last request.

curl -v http://[2001:db8::1234]:8000/syslog.2.gz --output x --next http://[2001:db8::1234]:8000/syslog.2.gz --output x  --next  -H "Connection: close" http://[2001:db8::1234]:8000/syslog.2.gz --output x

backend be_transparent
    mode http
    option http-keep-alive
    server myser 198.18.0.212:80


BR,


        

        

        

        


Best regards,

Tamara

*From: *Valentine Krasnobaeva <vkrasnoba...@haproxy.com>
*Date: *Tuesday, 10. June 2025 at 14:32
*To: *haproxy@formilux.org <haproxy@formilux.org>, Boehm, Tamara <tamara.bo...@sap.com>
*Subject: *Re: prefer-last-server with round robin lb algo


        

You don't often get email from vkrasnoba...@haproxy.com. Learn why this is important <https://aka.ms/LearnAboutSenderIdentification>

        

Hi Tamara!

Thanks for reporting this.

Non, round-robin is not deterministic, thus compatible with prefer-last-server and this option should not be ignored.

With which version are you observing this behaviour?

"prefer-last-server" is mainly used for keepalive with servers as the doc states and I see, that you are also using "option srvtcpka".

If you do tests with some external clients in parallel, make sure that these clients do not close its connections with haproxy between sending requests.

Could you provide your configuration, if possible + could you describe in which conditions you are observing this ?

As for doc, this info about load balancing alogorithms will be added explicitly.

In general, all supported algorithms, where hashing is envolved are deterministic.

Kind regards,

On 03/06/2025 14:39, Boehm, Tamara wrote:

    Dear community,

    We are using round-robin in HAProxy as a load-balancing algorithm.
    In our backend config, we use prefer-last-server as an option. But
    according to the documentation
    
(https://www.haproxy.com/documentation/haproxy-configuration-manual/latest/#4.2-option%20prefer-last-server),
    the option is only applied when the load balancing algorithm in
    use is not deterministic. We could not find any examples in the
    documentation of what load balancing algorithms HAProxy considers
    as deterministic. According to our understanding, the round robin
    algorithm is a deterministic one. Can you confirm whether our
    understanding is correct that this option prefer-last-server is
    fully ignored in our case?

    Our config looks like:

    backend http-routers-http1

        mode http

        balance roundrobin

        option srvtcpka

        no option http-server-close

        option prefer-last-server

    Thanks a lot and best regards,

    Tamara

--
Bien cordialement,
Valentine

--
Bien cordialement,
Valentine

Reply via email to