On Mon, Mar 14, 2011 at 05:49:05PM -0700, [email protected] wrote: > That's something I considered, but the ultimate problem is that the backend > service we're running (gearman) sometimes gets backed up with requests from > our web servers. In this case, the server still looks 'up' (I *think*) but > requests from PHP scripts are held up waiting for the gearman server to > process the request and close the connection. So having the backup server > option in this case wouldn't work, I don't think, *unless* 'backup' servers > in haproxy will cut in if the maxconn setting is exceeded. If that's the > case, then I suppose we could set the maxconn limit to a low setting and > have the queue option. Do you know if this behaviour exists in haproxy for > backup servers?
Guy, from what I understand, you'd like haproxy to serve as sort of a connection buffer. It would invent fake responses for your client and try to deliver its request to the servers once they're up, or maybe dump them on the floor. I see a way of queueing requests for a very long time when servers are not available : use a huge "retries" parameter, but the risk as you stated it is that you displace the bottleneck from the front servers to haproxy. Alternatively, you can use ACLs to detect whether some servers are available or not (or better, use a backup server which will be triggered when the other servers fail to accept the connection). That backup server (or the ACL) would loop back to a frontend that points to nowhere and returns a custom 503 page which basically just contains the data you want to be sent. That's probably as ugly as what you're looking for :-) The request will not be drained though, but it will be dropped as soon as the response is sent. The risk is that the system might send a TCP reset to the client if the client still pushes data after haproxy has closed. I must say I really don't know if that can match your needs, maybe it's something worth trying. Regards, Willy

