I hope my emails are not annoying you guys. To give a more complete picture
of this (pulled from methods I used in a client server app):

The initial process creates a shared memory area for the queue and then a
new thread, or child process, whose sole purpose is to dispatch connections
to workers. The shared memory area is a FIFO for queuing up connections. The
dispatcher process then goes on to set up the other children each of which
has access to the shared memory so they may get at the connection FIFO. The
FIFO is a linked list containing connection objects that get filled in by
the listener thread/process. The dispatcher maintains a list of all children
workers that it created, and sits in a loop sleeping with some set timeout.
When the listener accepts a connection and puts it in the queue, it wakes
the dispatcher if need be. Once awakened, the dispatcher looks to see if
connections are queued, and if so, it looks in its worker list for the next
available worker and awakens it. The worker then locks the FIFO head pointer
and grabs the connection, moves the pointer to the next FIFO node, and then
unlocks the FIFO head pointer. If no workers are available, the dispatcher
creates more workers if not at a set maximum in order to take the
connection. If at the maximum, it sleeps again with a shorter timeout, which
when woke up again, checks for an available worker again. This repeats until
a worker is available. The listener in all of this is totally independent of
the workers, and only knows that it accepts connections and puts them in a
FIFO, and finally notifies the dispatcher of the connection. The connection
queue could span thousands of queued connections if desired. The dispatcher
is responsible for coordinating the workers, and the queue resides in one
place only, that being the shared memory segment.

Is this too drastic an alteration to the current worker mpm, i.e. would it
be a separate mpm if it came to fruition?

Billy Rose 
[EMAIL PROTECTED]

> -----Original Message-----
> From: Brian Pane [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, April 11, 2002 2:49 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [PATCH] convert worker MPM to leader/followers design
> 
> 
> Rose, Billy wrote:
> 
> >Would the solution in my last email do what you are looking for?
> >
> 
> My one concern with your solution is that it puts a queue in the
> httpd child processes.  I think that putting a queue in each child
> is always going to be tricky because you can get things stuck in the
> queue of one busy child process while other child processes are idle.
> 
> What I like about designs like leader/follower and prefork is that
> they share one queue across all child processes (and the queue is
> maintained by the TCP stack).
> 
> --Brian
> 
> 

Reply via email to