Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 03 Apr 1997 16:00:09 -0800
From:      David Greenman <dg@root.com>
To:        Marc Slemko <marcs@znep.com>
Cc:        FreeBSD-hackers <FreeBSD-hackers@freebsd.org>
Subject:   Re: apache like preforking apps and high loads 
Message-ID:  <199704040000.QAA05674@root.com>
In-Reply-To: Your message of "Thu, 03 Apr 1997 13:34:29 MST." <Pine.BSF.3.95.970403130536.2532B-100000@alive.znep.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
>On Thu, 3 Apr 1997, David Greenman 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.
>
>Looking at these changes and the other code around them, it appears to me
>like the net effect is that processes are added to the tail of the queue
>when they block on accept()  and removed from (near) the head with
>wakeup_one.  Am I reading this right, or am I getting my queue ends mixed
>up somewhere?

   You have it right, and that is the way it needs to work. I don't know
how Apache does it's # processes load balancing, but fairness can be important
in general.

>For code that does similar things to what Apache does, it would be far
>better to treat it as a stack and have wakeup_one() remove from the tail
>since you want the same processes to serve as many requests as possible. 
>In the grand scheme of things it may be a bad idea to have wakeup_one() 
>behave this way, but it looks like it would be useful in this case. 

   On the x86 and most other architectures, the cache is of physical memory
and the majority of the Apache code is in shared pages. There isn't any
significant difference in terms of cache effects whether you wake the same
process all the time or you wake different processes.

-DG

David Greenman
Core-team/Principal Architect, The FreeBSD Project



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704040000.QAA05674>