httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dean gaudet <dgaudet-list-new-ht...@arctic.org>
Subject Re: mod_file_cache performance
Date Tue, 03 Jul 2001 04:07:56 GMT


On Mon, 2 Jul 2001, Bill Stoddard wrote:

> For example, if you have three responses to serve pipelined, each with
> three file handles, how do you make all the packets go out optimally
> filled?

TCP_CORK...

> On Linux, can you TCP_CORK, call sendfile() x times then do an uncork
> and have all the packets flow out optimally filled?

yup!

the challenge is all the other kernels :)  what you're doing now is
probably OK for those, except i'd wager that you don't even want to bother
with mmap 'cause you're dealing with less than page sized files.

> Am I correct in assuming that you suggest we not use MMAP at all in a
> threaded server? That is, only use sendfile() or read(file,
> buf)/write(socket,buf) when using threaded MPMs?

if the kernel is not so hot at maintaining its own efficient filename ->
file_data mappings, or doesn't have sendfile() or a good method to take
advantage of filename -> file_data mappings then you can possibly get
better performance by using mmap() in a persistent manner.

that is to say... mod_file_cache is probably worth it on some systems.
but i'm guessing that on linux it's not going to help.

you basically want to amortize the mmap() over multiple uses, and then you
don't worry so much about the cross-CPU interrupts required to set up the
mappings... 'cause eventually you'll reach a steady state and mmap() won't
happen any more.

but this means you'll have to worry about cache management -- mmap()ed
pages may not decay out of the page cache as easily, you might get weird
low memory problems.  you'll need to do your own locking on your shared
cache structure, etc.

the linux gurus (linus especially) think the best method on linux is to
take url, prepend a document root, open(), sendfile(), close().  that's
essentially what phhttpd did -- and it was damn fast.  (phhttpd was an
experiment prior to TUX... there's also X15 today which is as fast as TUX,
but with a restrictive source license, so i hesitate to suggest stracing
it ;)

-dean


Mime
View raw message