Re: Linus on Linux, Apache and Threads

Stuart Lynne (sl@gateway.fireplug.net)
23 Apr 1999 02:00:57 GMT


In article <371FA468.5308ABE8@noah.dhs.org>,
Joshua E. Rodd <jerodd@noah.dhs.org> wrote:
>Gary Lawrence Murphy wrote:
>> In the excerpt from OpenSources on LinuxWorld, there is
>> an omninous statement in Linus' musings which goes
>> "Of course Linux isn't being used to its full potential even
>> by today's web servers. Apache itself doesn't do the right
>> thing with threads, for example"
>> What *should* Apache be doing?
>
>Apache should not use a seperate process for each HTTP request.
>It ought to one of two things:
>
> - Use a thread to handle each request, all in one process.
> There is already an alpha pthreads Apache out there, but
> it's virulently unstable (I used it on OS/2, and it had
> SEGV/BUS errors almost nonstop). If you enjoy playing with
> threads, check it out.

Apached processes are long lived processing multiple requests. So doesn't it
boil down to the difference between passing file descriptors to child processes
or a different thread? That and the fact that you probably can have a larger
number of active threads than processes for any given amount of memory you
want to use?

This is not to say that the file passing model is optimal. A select() loop
should be faster. But the apache team seems to be more interested in robust
and portable with reasonable performance than performance at any cost.

> - Be event-driven rather than procedure-driven by using
> select(2) to serve files. (Obviously CGI scripts and anything
> hard to do in an event-driven manner can be done with a
> new spawned/forked process.)
>
>Note that on *.BSD, Apache's process-intensiveness is not an
>issue because *.BSD kernels can fork at a mind-boggling rate.

For static pages that can be fetched without additional processing normal
apache child processes should not have to fork additional processes this
should not be an issue. CGI requests would benefit from fast fork()ing.

-- 
Stuart Lynne <sl@fireplug.net>      604-461-7532      <http://edge.fireplug.net>
PGP Fingerprint: 28 E2 A0 15 99 62 9A 00  88 EC A3 EE 2D 1C 15 68

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/