Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 1997 10:50:19 -0700 (MST)
From:      Marc Slemko <marcs@znep.com>
To:        Bakul Shah <bakul@torrentnet.com>
Cc:        Guido van Rooij <guido@gvr.win.tue.nl>, FreeBSD-hackers <FreeBSD-hackers@freebsd.org>
Subject:   Re: apache like preforking apps and high loads 
Message-ID:  <Pine.BSF.3.95.970403104113.1910A-100000@alive.znep.com>
In-Reply-To: <199704031653.LAA20772@chai.plexuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 3 Apr 1997, Bakul Shah wrote:

> > >When looking at Apacha like applications, one often sees extermely high
> > >load averages. Apache preforks a number of processes that all block
> > >on accept(). When a request comes in, all process are woken up and the
> > >scheduler chooses one of the now runnable processes taht will succeed in
> > >the accept(). The other go back to sleep.
> > 
> >    Not any more. I changed this a few days ago. Now only one process is
> > woken up.
> 
> Fairness is probably not an issue when an app. consists of a number
> of anonymous servers but in general one would want to make sure that
> if N processes are waiting on accept() on the same socket, no one
> process is starved of accepting.  How do you ensure that?

For something like Apache you want the _least_ equal distribution
possible, ie. a stack of most recently used processes from which you pop a
server to process a request.  Right now, if you have 100 servers running
and get requests at a rate that one could handle, all of them will still
be used.  This is bad; it hurts locality of reference a lot.  On some
architectures, it has a significant impact WRT caching, and also means
that if you don't have enough RAM for all server processes then they will
each end up being swapped out and in again.

The reason why Apache doesn't do this is the implementation details.  It
is difficult to get a good implementation that is efficient (so you don't
create more overhead than you remove) and portable. 

Sort of timed destruction of child processes could help; right now you are
limited to how it is hard coded in Apache and if you set MaxSpareServers
too low you run into problems with short term load fluctuations. 

> To guido:  For apache like apps one idea is to have one process be
> the acceptor and have it pass a new socket to individual server
> processes (including doing some initial processing to determine
> which process should get this socket if not all server processes are
> equivalent).

This has a lot of portability issues and can lead to running into things
such as per process fd limits more quickly on some architectures. 





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.970403104113.1910A-100000>