Per-user queueing - rate-limiting users without rejecting requests

2017-07-16 Thread Will Bryant
Hi all,

One of the best features of haproxy is that it allows us to limit the number of 
outstanding requests sent to a particular backend using maxconn.

Separately, another useful feature is that it lets us configure TCP rules using 
ACLs and stick-tables, so we can for example reject requests from a particular 
client that exceed a certain rate-limit.

I’m trying to find a way to combine these two features.  We have some pages in 
our application that take much longer than others to serve.  If a single user 
hits a number of those slow pages at once (for example, shift+clicking a number 
of links off an index page), they can inadvertently use up all of our backend 
web workers, which effectively takes the site down for other users.  I would 
like to be able to limit the number of concurrent requests served for any 
single user - but without rejecting the traffic and causing errors.

So I’d like the requests (or TCP connections, if that is easier) to be queued 
up, as if maxconn was per user rather than per frontend or per backend rather 
than rejected with an HTTP error.

Patrick Hemmer asked about related solution recently on this mailing list, 
where he wanted to redirect clients (after a sleep) if they had more than a 
certain number of connections open.  My use case is slightly different to 
Patrick's in that some of the slow requests are non-idempotent (POSTs) and so a 
redirect solution is a bit iffy - I’d like to avoid relying on the behavior of 
the client in re-sending the request.

In the following thread, Michael Ezzell then made a similar requests to me - 
per client-queueing.

Is there any way to do this?

Thanks,
Will


Using http_proxy in HAProxy 1.6.3

2017-07-16 Thread Krishna Kumar (Engineering)
I have configured a backend as follows:

backend be-testing
mode http
option httpclose
option http_proxy

and hit this using Google's IP as:
 wget  --header="Host: http://216.58.197.46:80; 

but this fails with 503 error, debug shows:
0003:fp-testing.clireq[0009:]: GET / HTTP/1.1
0003:fp-testing.clihdr[0009:]: User-Agent: Wget/1.16 (linux-gnu)
0003:fp-testing.clihdr[0009:]: Accept: */*
0003:fp-testing.clihdr[0009:]: Host: http://216.58.197.46:80
0003:fp-testing.clihdr[0009:]: Connection: Keep-Alive

What am I doing wrong? Is it also possible to use DNS name with a newer
version of HAProxy?

Thanks,
- Krishna