On Wed, Jan 07, 2009 at 05:02:09PM +0100, Nicolas MONNET wrote:
> I'm working on a weird app which just stops listening ("connection
> refused") in some conditions, and the just as weird client relies on
> this. I'm using haproxy to load-balance to several application servers.
> Is there a simple way to have haproxy stop listening when it detects no
> backend is responding during its checks? If not what would you advise we
> use to trigger a script to do that based on the log contents?
I recently encountered the same requirement. Right now this is not possible, especially because we would need to detail the conditions to make the listener disappear, which would probably require some ACLs, and ACLs are limited to traffic processing.
But I was thinking that now the ACLs are typed, so we could make use of the stateless ACLs (eg: nbsrv) for that, and use those when deciding whether a frontend should be open or closed. It would not be too hard to implement, because we'd basically add an ACL check in maintain_proxies().
But you must keep in mind that even if we stop accepting requests, the connection will only hang once the system's backlog is full, which may take some time.
Another possibility I thought about was the same as what we do with hot reconfiguration, which means shutting down the listening socket, then doing the listen again. Unfortunately, it appears that while it's OK to do that on Linux, other systems don't support that trick very well, and I want to avoid doing non-portable features as most as possible.
Willy Received on 2009/01/11 11:02
This archive was generated by hypermail 2.2.0 : 2009/01/11 11:15 CET