httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject Re: using sendfile on MMAP'd buckets
Date Wed, 12 Sep 2001 01:27:43 GMT
On Sun, Sep 09, 2001 at 01:34:50PM -0700, Ryan Bloom wrote:
> On Sunday 09 September 2001 12:00, Marc Slemko wrote:
> > On Sun, 9 Sep 2001, Brian Pane wrote:
> > > On Linux, at least, it's a win.  I did some experiments a few weeks ago
> > > and found that, after doing open and mmap on a file, it's faster to send
> > > it with sendfile than with write.
> >
> > If you are going to use sendfile(), then mmap()ing the file to begin
> > with is pointless and just adds overhead.  It would seem that it would be
> > better to delay on making a decision about if a file will be mmap()ed or
> > not until there is some actual need to mmap it instead of just doing it
> > anyway.
> 
> We already do that.  We only mmap the file when a filter wants to read from
> it.  The problem now, is that we have already scanned all the data, and there
> were no changes to to data.  Now, do we try to use sendfile, or just use
> the mmap'ed data?

My $.02 - with Solaris's sendfilev, it can take in a -1 (FD_SELF or
something like that) for the file descriptor which means that you 
should read starting at the offset location from your memory space.  
I have comments in the Solaris-specific code in APR about this.

Not all OSes do this, but Solaris does.  I think FreeBSD does too,
but their implementation is obviously non-threadsafe.  =-)

sendfile should typically be a win over writev, but since we're 
reading in from memory that may or may not be the case - tests 
are probably warranted.  -- justin


Mime
View raw message