Upstream (fair) with dead servers

Igor Sysoev is at rambler-co.ru
Thu Jul 9 19:14:54 MSD 2009


On Thu, Jul 09, 2009 at 05:09:56PM +0200, Kamil Gorlo wrote:

> 2009/7/9 Igor Sysoev <is at rambler-co.ru>:
> > On Thu, Jul 09, 2009 at 04:47:43PM +0200, Kamil Gorlo wrote:
> >
> >> Hi,
> >>
> >> I have (possibly quite rare) situation where I have one upstream with
> >> two servers and I know that in any particular moment only one of those
> >> servers is running:
> >>
> >> upstream blah {
> >>     server server1; // when working, server2 is dead
> >>     server server2; // when working, server1 is dead
> >> }
> >>
> >> So, what I need is that Nginx will choose working backend (in this
> >> upstream), remembers it and choose it for every request till some
> >> failure on this server occurs. Then it tries other server in upstream,
> >> till it finds some working - and situation repeats. Is this possible?
> >
> > No, nginx will send request on both servers in round robin mode.
> > If one of them will fails, then nginx will resend the failed request
> > to another server and mark the server as dead for fail_timeout time.
> 
> Hmm, what about situation when all servers are marked as dead? Nginx
> will wait till fail_timeout expires for some server and in meantime
> return error to client? Or will try dead servers?

In this case nginx marks all servers as live and try again.

> Also, is it hard to write such a "upstream-chooser" which will work as
> I described?

I'm going to rewrite upstream modules in 0.8.x (add fair, etc.) and
probably add this functionality. But why do you want to send request
to one only server leaving the other as spare one ?

> >> Maybe upstream_fair module with option no_rr will work for me (I am not sure)?
> >>
> >> Cheers,
> >> --
> >> Kamil Gorlo


-- 
Igor Sysoev
http://sysoev.rua/en/





More information about the nginx mailing list