httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <>
Subject Re: newbie thread/process model question in hybrid server
Date Mon, 05 Jul 1999 14:56:52 GMT
yOn Sat, 3 Jul 1999, Thorsten von Eicken wrote:

> I've been reading 2.0/mpm for a couple of days and am still a bit puzzled 
> by the hybrid server's strategy of using processes and threads. More 
> precisely, I don't understand why the number of threads per process is 
> constant and the number of processes varies with load.

The reasoning behind this is largely historical.  It was decided to use a
variable number of processes, and a fixed number of threads, because it
was easier to code, and this was a first draft/prototype.  We also looked
at some previous implementations of similar code that tried to grow the
thread pool, and most pthread libraries have memory leaks.  When a thread
is destroyed, either by itself, or by another thread, it almost always
leaves some memory around, and this can get quite large in time.  We were
going for a proof of concept, and proff that a hybrid Apache was more

This also would have required a very different scheme for controlling
threads/processes.  The parent process really couldn't determine when to
tell a process to create a new thread in the current communication model.
Dean is trying to solve this problem, but it isn't a problem we wanted to
tackle in the first implementation.  We wanted to keep the basic
architecture for Apache the same.


>  From a parallel computing background I would have done the opposite. I 
> would have expected to set the number of processes to approx the number of 
> processors in the system, and then used the threads to basically multiplex 
> one processor. Ideally some affinity between processes and processors could 
> be set-up to improve cache behavior. Thus the threads are used to keep 
> track of the state for the N requests each process has up in the air at a 
> given time and the processes are used to get parallelism across the 
> processors of a multiprocessor machine.
> Can a kind soul explain to me how to think about the approach taken in the 
> hybrid server?
> Thanks,
> 	Thorsten von Eicken
> ~~~~~
> Thorsten von Eicken
>                              Phone: (805) 964-0383 x313
> 5385 Hollister Ave #111                     Fax:   (805) 964-6103
> Santa Barbara, CA 93111                     Cell:  (805) 403-0982

Ryan Bloom
4205 S Miami Blvd	
RTP, NC 27709		It's a beautiful sight to see good dancers 
			doing simple steps.  It's a painful sight to
			see beginners doing complicated patterns.	

View raw message