httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manoj Kasichainula <>
Subject Re: fix for hybrid server problems.
Date Sun, 09 May 1999 09:21:33 GMT
On Mon, May 03, 1999 at 12:05:22PM -0700, Dean Gaudet wrote:
> The event thread communicates with worker threads through two queues --
> the request queue, and the response queue.
> Implement the request queue using whatever pthread synchronization
> method seems appropriate.  The request queue can contain two different
> data items -- a new connection, or a request_req of a finished static
> response (with extra info needed for logging).
> The response queue contains request_req's and the assorted fd/mmap info
> needed to send the static response.  The response queue is implemented
> using a pipe so that the event thread can use select() to find out when
> it has events.  We can actually write "void *"s onto the pipe.

My understanding is that a select()-based server is fast because you
don't have to deal with many context switches, right?

In this case though, we have at least 1 forced context switch for
every connection (to pass a new connection to a worker thread). And
for the slightly big files, we have to jump back to the event thread
and back again to a worker thread for logging.

With long files, you avoid the context switching between threads as
they write out the data, but couldn't this be largely eliminated with
mmap+write or sendfile() anyway?

Manoj Kasichainula - manojk at io dot com -
"When you say `I wrote a program that crashed Windows', people just stare at
you blankly and say `Hey, I got those with the system, *for free*'"
  -- Linus Torvalds

View raw message