Hello folks,
I found a strange behaviour when mixing "balance uri" and "option
prefer-last-server".
It seems the latter is prefered to serve a request. That means that
the same URL may be served by two different backends, based on the
query before + keepalive.
One short example will be :
GET /test1 => server1
GET /test2 => server2
GET /test2 + /test1 in the same connection (keepalive) => server2 for
both queries
Documentation for prefer-last-server says:
When the load balancing algorithm in use is not deterministic, and a previous
request was sent to a server to which haproxy still holds a connection, it is
sometimes desirable that subsequent requests on a same session go to the same
server as much as possible.
To me, "balance uri" is deterministic so prefer-last-server should not
be used in this case. I then wondered if this is an expected behaviour
or not.
Olivier
P.S.
I'm sorry to not provide a complete config file to reproduce it, I was
unable to get haproxy returns a "Connection: keep-alive" header (even
with http-pretend-keepalive), my static file always get rewritten with
'connection: close'.
I found a strange behaviour when mixing "balance uri" and "option
prefer-last-server".
It seems the latter is prefered to serve a request. That means that
the same URL may be served by two different backends, based on the
query before + keepalive.
One short example will be :
GET /test1 => server1
GET /test2 => server2
GET /test2 + /test1 in the same connection (keepalive) => server2 for
both queries
Documentation for prefer-last-server says:
When the load balancing algorithm in use is not deterministic, and a previous
request was sent to a server to which haproxy still holds a connection, it is
sometimes desirable that subsequent requests on a same session go to the same
server as much as possible.
To me, "balance uri" is deterministic so prefer-last-server should not
be used in this case. I then wondered if this is an expected behaviour
or not.
Olivier
P.S.
I'm sorry to not provide a complete config file to reproduce it, I was
unable to get haproxy returns a "Connection: keep-alive" header (even
with http-pretend-keepalive), my static file always get rewritten with
'connection: close'.