Hello Bernhard,
On Wed, Feb 16, 2011 at 12:16:40PM +0100, Bernhard Krieger wrote:
> Hello,
>
> we provide one application ( apache+tomcat ) which should have very
> short response times.
> If a backend dies, the HAproxy should mark this backend "DOWN" as soon
> as possible.
You could be interested in looking at the "observe" and "on-error"
server statements. They allow you to take a server down based on the
observed traffic. You can for instance detect connection errors and
mark it down without waiting for the next check ("observe layer4").
You can also check if its responses are valid and take it down for
all unexpected error (mostly 5xx status codes) using "observe layer7".
There's a wide combination of options, you may mark the server as
suspicious so that a check is immediately restarted after such an
error.
> If all backends getting down, HAProxy should mark Frontend DOWN asap
> and reply with an errorcode asap.
You don't really "mark" a frontend DOWN, because the frontend works
regardless of the server. However, you can divert the traffic to another
backend, refuse to use the backend or redirect to an error page. The
"nbsrv" ACL returns the number of usable servers in a backend. So you
can use it like this :
frontend xxx
acl back_ok nbsrv(back) gt 0
use_backend back if back_ok
default_backend dead
backend back
server xxx ...
backend dead
other servers, or a redirect rule, or an error message
> What options need to be changed to meet this requirement?
>
> http mode
> rise 1
> fail 1
> inter 500
If your servers can easily handle a 500ms interval for checks, I'd
rather even reduce this interval and increase the "fall" statement
to 2. It covers the rare false failures caused by occasional network
hickups that can occur.
> timeout server ?
> timeout client ?
> timeout connect ?
timeout server and timeout connect should match what you consider is
acceptable. Maybe you accept larger times when the client is responsible
for the delay, so you can have "normal" client timeouts (several seconds).
> are there other options ?
Please take a look at "observe" and "on-error" as indicated above.
> THX
>
> regards
> Krieger Bernhard
Regards,
Willy