httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <>
Subject Re: new acceptor logic.
Date Mon, 22 Feb 1999 18:51:54 GMT

On Mon, 22 Feb 1999, Manoj Kasichainula wrote:

> > Or pay one worker per socket -- let multiple be in accept, just on
> > different sockets.  If folks have less than busy sockets they'll be paying
> > one less than busy thread... but little extra cpu otherwise.
> If I understand this, we have to have a mechanism to make sure that
> worker threads accept() on the busiest sockets. We've thought about
> it, since it's what the mainframe web server developers are working
> with, but we haven't come up with a bulletproof way of doing this on
> Unix yet. Thoughts?

No, you need M+N threads where M is the number of sockets, and N is the
number of threads you want to have in flight servicing requests.  KISS ... 
don't do anything special for the busy sockets -- just keep a FIFO list of
sockets that don't have anything accepting on them.

It's not too hard -- for a single socket you need one lock, acquire it
when going into accept().  For multiple sockets you need a FIFO of sockets
ready for accept, with a lock for that FIFO... although on first
inspection it seems you need to acquire the FIFO twice per accept, which
sucks... there's probably a trick you can play depending on which of the
various pthread locking primitives are available. 


View raw message