Re: InfoWorld web server shootout

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 8 Jul 1997 21:55:57 +0100 (BST)


> It would be easy to make a mod_mmap which has a */* handler. If someone
> has the time/inclination to do so I'd love to see it. I've got way too
> much on my List right now though.

In terms of a pure speed web server for static data (where mmap is a big win)
the right way[TM] is probably to preindex all the files you can serve and
to mmap the lot into memory at setup time with a one page gap between them
that contains precomputed HTML headers for each page. You then build an
index of the pointers to each URL, feed all the URL's through the GNU
perfect hash program to generate a hash and each web page serve becomes

x=unhash(url)
if(x==NULL)
x=NOT_FOUND_ENTRY;
write(socket, x->data,x->len)
close(socket);

if you want to play total speed then someone should write a web server that
does this and uses clone() to create all of its threads. I suspect you can
probably serve a web page in about 20 syscalls, less if the headers arrive
in one chunk from the client.

Now that would be THE web server of choice for porn sites 8)

Alan