Re: Limiting the size of the backend queues

2016-02-10 Thread Chris White
Ideally I would like to return 429 Too Many Requests.
 





-Original Message-
From: Willy Tarreau <w...@1wt.eu>
Date: Tuesday, February 9, 2016 at 11:27 PM
To: Chris White <chris.wh...@illumio.com>
Cc: "haproxy@formilux.org" <haproxy@formilux.org>
Subject: Re: Limiting the size of the backend queues

>On Tue, Feb 09, 2016 at 03:45:15PM +, Chris White wrote:
>> I have been looking at the documentation for haproxy and I can???t seem to
>> find anyway of limiting the size of each backend proxy queue. I can see how
>> to limit the queue size and number of connections handle by each of the
>> backend servers.  I can see how to configure the backend queue timeout, but
>> no way of actually limiting the total number of requests queued per backend
>> proxy. I really want to put limits on how many requests are queued per
>> backend proxy, is there anyway of doing this?
>
>Limiting is one thing, but what matters is what happens once the limit is
>reached. Are you sure you want to return a 503 in such a case ?
>
>Willy
>


Re: Limiting the size of the backend queues

2016-02-10 Thread Willy Tarreau
On Wed, Feb 10, 2016 at 02:47:23PM +, Chris White wrote:
> Ideally I would like to return 429 Too Many Requests.

It's not suited at all. 4xx are reports of client cause. The client
cannot do anything to fix this issue. Here the cause is the server,
it must be a 5xx, and the only one that fits is 503 (which we already
use for that purpose).

Anyway, I wanted to be certain that you were conscious about the
impact of rejecting clients based on the queue length.
 
In the mean time you can already use the "queue" sample fetch to write
a rule in your backend, for example :

   backend foo
   tcp-request content reject if { queue ge 100 }

This will cause the connection to abort (useful in TCP), or do it using
"http-request" instead of "tcp-request content" and it will return a 403
(or the page that you provide for this, which can be configured with the
errorfile directive).

Also please have a look at the documentation regarding the "queue" function
above, there are some hints to do something a bit better like only reject
new users etc.

Willy




Limiting the size of the backend queues

2016-02-09 Thread Chris White
I have been looking at the documentation for haproxy and I can’t seem to find 
anyway of limiting the size of each backend proxy queue. I can see how to limit 
the queue size and number of connections handle by each of the backend servers. 
 I can see how to configure the backend queue timeout, but no way of actually 
limiting the total number of requests queued per backend proxy. I really want 
to put limits on how many requests are queued per backend proxy, is there 
anyway of doing this?

Chris White


Re: Limiting the size of the backend queues

2016-02-09 Thread Willy Tarreau
On Tue, Feb 09, 2016 at 03:45:15PM +, Chris White wrote:
> I have been looking at the documentation for haproxy and I can???t seem to
> find anyway of limiting the size of each backend proxy queue. I can see how
> to limit the queue size and number of connections handle by each of the
> backend servers.  I can see how to configure the backend queue timeout, but
> no way of actually limiting the total number of requests queued per backend
> proxy. I really want to put limits on how many requests are queued per
> backend proxy, is there anyway of doing this?

Limiting is one thing, but what matters is what happens once the limit is
reached. Are you sure you want to return a 503 in such a case ?

Willy