Hi Fabian,
On Mon, Jul 20, 2009 at 06:11:45PM +0200, Fabian wrote:
> Hi List,
>
> I'm trying to set up a simple tcp load balancing:
>
> The backend servers can only handle one request at a time and the
> requests take between 2-15 seconds to process.
> I want haproxy to distribute the tcp requests to any free backend server
> currently not processing a request (no active connection).
> If all backends are currently active I want to queue the pending
> requests globally and as soon as a backend becomes "free" the oldest
> request in the queue should be redirect to the free backend server.
>
> Unfortunatly I can't get the queing to work. When there are pending
> connections and a backend server becomes idle, it takes a long time
> before a pending connection is handed to the server. Sometimes the
> connection even gets a timeout despite the fact that a backend server is
> idle for already 20 seconds.
Your configuration is right. I think that your problem is simply
that when you have too many incoming requests, the time to process
them all one at a time is too long for the last one to be served.
When unspecified, the queue timeout is equivalent to the connect
timeout (50s here). So I would suggest that you lower your connect
timeout to 5s and set "timeout queue 2m" for instance. Also, I
suggest that you enable a stats page to monitor the activity in
real time. It's really useful to check queueing. You just have
to add :
listen :8888
mode http
stats uri /
and you connect to this port with your browser. You'll see the
backend queue size, and the max it reaches.
Regards,
Willy