RE: rate limiting according to "total time" - possible ?

2015-09-14 Thread Roland RoLaNd
That's exactly what i wanted!!
thank you willy


> Date: Mon, 14 Sep 2015 07:38:08 +0200
> From: w...@1wt.eu
> To: r_o_l_a_...@hotmail.com
> CC: haproxy@formilux.org
> Subject: Re: rate limiting according to "total time" - possible ?
> 
> Hi Roland,
> 
> On Fri, Sep 11, 2015 at 05:11:11PM +0300, Roland RoLaNd wrote:
> > hello
> > i have haproxy directing traffic to a number of backends.
> > these backends can auto scale upon traffic; my goal is to change "maxcon" 
> > depending on "total time" or "backend time"  that a request took to 
> > complete.
> > for example:
> > if totaltime < 1 second ; maxcon = 1000if totaltime < 2 second: maxconn = 
> > 500etc...
> > 
> > the goal is to hold connections in queue till backend auto scaling is in 
> > effect.
> > 
> > Can i do the above scenario within haproxy config or a cron that checks 
> > haproxy socket/totaltime and act accordingly is a better idea?
> > 
> > do you have an alternative advice for me to accomplish that goal ?
> 
> I could be wrong, but I think you're trying to re-implement by hand the
> dynamic rate limiting you can get using minconn,maxconn and fullconn. It
> dynamically increases or decreases the effective per-server maxconn
> depending on the total number of connections on all servers in the
> backend so that queues decrease when connection count increases.
> 
> Willy
> 
> 
  

Re: rate limiting according to "total time" - possible ?

2015-09-13 Thread Willy Tarreau
Hi Roland,

On Fri, Sep 11, 2015 at 05:11:11PM +0300, Roland RoLaNd wrote:
> hello
> i have haproxy directing traffic to a number of backends.
> these backends can auto scale upon traffic; my goal is to change "maxcon" 
> depending on "total time" or "backend time"  that a request took to complete.
> for example:
> if totaltime < 1 second ; maxcon = 1000if totaltime < 2 second: maxconn = 
> 500etc...
> 
> the goal is to hold connections in queue till backend auto scaling is in 
> effect.
> 
> Can i do the above scenario within haproxy config or a cron that checks 
> haproxy socket/totaltime and act accordingly is a better idea?
> 
> do you have an alternative advice for me to accomplish that goal ?

I could be wrong, but I think you're trying to re-implement by hand the
dynamic rate limiting you can get using minconn,maxconn and fullconn. It
dynamically increases or decreases the effective per-server maxconn
depending on the total number of connections on all servers in the
backend so that queues decrease when connection count increases.

Willy