Re: Linus on Linux, Apache and Threads

Greg Lindahl (lindahl@cs.virginia.edu)
Thu, 22 Apr 1999 19:45:24 -0400 (EDT)


> Apache should not use a seperate process for each HTTP request.

It doesn't. By default each child process serves 30 requests before
exiting; you can turn that up if the requests are simple. This
optimization is in there precisely because fork() isn't free.

> - Use a thread to handle each request, all in one process.

Then you lose the memory protection that the current scheme gets you.

> There is already an alpha pthreads Apache out there, but
> it's virulently unstable

Doh! Hammer. Head. Bang. OK, I'm mostly joking, but...

> - 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.)

That's how ircd works, but I wouldn't necessarily think it would be
better under load. select() is not cheap, and you have extra system
calls to avoid blocking while sending output, and you have to avoid
blocking on the disk.

Now if you invented a syscall which was specifically designed to
collect input from many sockets and write output to many sockets, that
might be a win.

-- g

-
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/