Hi,
during evaluation of Haproxy for our internal loadbalancer we encountered 
following problem.
Our backend sends very short responses (less than 1000 bytes). 
Transfer-encoding is set to chunked.
Client connecting via haproxy experiences unexpectedly long delays (about 2-3 
seconds) before receiving response.
Larger responses (larger than about 1223 bytes) are received immediately. 
Obviously, when connecting to the backend directly, there is no such delay.
We experienced this behaviour with three different backends (tomcat, weblogic 
and glassfish).

We analyzed the communications with tcpdump and came to following conclusions:

Haproxy seems to buffer the response received in several TCP packets, before 
sending it to the client (which is understandable).
Delays described above happen when the whole response is received by haproxy 
(last chunk 0<CR><LF><CR><LF> is received) before it starts sending response to 
the client
(probably response still fits some buffer). The whole response is sent to the 
client in one TCP packet.
With longer responses haproxy sends response to the client in two or more TCP 
packets, and there is no delay before the last packet (when last chunk is 
received).

We were able to workaround this problem with following solutions:
 - option http-no-delay
 - option http-server-close

We read some discussions about similar problems 
(http://www.mail-archive.com/[email protected]/msg05419.html), but we find 
our situation different - we are not abusing http protocol. 
It's different, because we experience delays after the whole message was sent 
by the backend.

Attached you will find our sample haproxy config file and tcpdump output.

Best regards
Jaroslaw Bojar & Mikolaj Gierulski
-- 
Niniejsza wiadomość pochodzi z domeny @agora.pl, należącej do Grupy
Kapitałowej Agory. Główne spółki wchodzące w skład Grupy Kapitałowej
Agory to:

Agora SA, ul. Czerska 8/10, 00-732 Warszawa; Numer identyfikacji
podatkowej: PL 526-030-56-44; Miejsce zarejestrowania: Sąd Rejonowy dla
m. st. Warszawy: Numer rejestru KRS: 59944; Kapitał zakładowy:
50.937.386 zł, wpłacony w całości.

Agora - Poligrafia Sp. z o.o., ul. Towarowa 4, 43-110 Tychy; Numer
identyfikacji podatkowej: PL 646-20-72-095; Miejsce zarejestrowania: Sąd
Rejonowy w Katowicach Numer rejestru KRS: 72481; Kapitał zakładowy:
1.000.000,00 zł.

Grupa Radiowa Agory Sp. z o.o., ul. Czerska 8/10, 00-732 Warszawa; Numer
identyfikacji podatkowej: PL 521-289-70-03; Miejsce zarejestrowania: Sąd
Rejonowy dla m. st. Warszawy Numer rejestru KRS: 126767; Kapitał
zakładowy:  25.019.500,00 zł.

Więcej informacji  o spółkach na stronie: www.agora.pl Wiadomość jest
przeznaczona wyłącznie dla zamierzonego adresata i może zawierać
informacje o charakterze poufnym. W razie stwierdzenia, że odbiorcą
miała być inna osoba prosimy poinformować nadawcę oraz niezwłocznie
usunąć wiadomość. Wiadomość może nie stanowić oficjalnego stanowiska
spółki Agora SA i nie być związana z jej działalnością.
------------
This message was sent from domain @agora.pl belonging to Agora Group.
Principal companies in the Agora Group structure are:

Agora SA, ul. Czerska 8/10, 00-732 Warszawa; Polish VAT and tax ID no.:
PL 526-030-56-44; Place of registration: Regional Court for the Capital
City of Warsaw; Registration no.: 59944; Share capital: PLN 50.937.386,
fully paid-up.

Agora - Poligrafia Sp. z o.o., ul. Towarowa 4, 43-110 Tychy; Polish VAT
and tax ID no.: PL 646-20-72-095; Place of registration: Regional Court
in Katowice; Registration no.: 72481; Share capital: PLN 1.000.000,00.

Grupa Radiowa Agory Sp. z o.o., ul. Czerska 8/10, 00-732 Warszawa;
Polish VAT and tax ID no.: PL 521-289-70-03; Place of registration:
Regional Court for the Capital City of Warsaw; Registration no.: 126767;
Share capital: PLN 25.019.500,00.

For more information about our companies see site: www.agora.pl This
message is for the intended recipient only and it may contain
confidential information. If you receive this message in error, please
immediately delete it and notify the sender. This message may not
represent the official views of Agora SA and may not be related to its
business.


Reply via email to