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