Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Mar 1998 22:40:02 -0700 (MST)
From:      Marc Slemko <marcs@znep.com>
To:        Mike Smith <mike@smith.net.au>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: kernel wishlist for web server performance
Message-ID:  <Pine.BSF.3.95.980307223608.2799K-100000@alive.znep.com>

next in thread | raw e-mail | index | archive | help
On Sat, 7 Mar 1998, Mike Smith wrote:

> > A sendfile() (eg. HPUX 11.x) or TransmitFile (eg. WinNT) system call. 
> > The key features are: 
> > 
> > 	- it can transmit from an arbitrary start position and an 
> > 	  arbitrary length.  Sending starting from the current position
> > 	  is ok I guess, but requires a mutex to allow multiple 
> > 	  threads to start it on the same descriptor at the same time and
> > 	  adds the overhead of a seek.
> > 	- An AIO version of this system call would be very useful; 
> > 	  NT can do this with its completion ports API.  This is required
> > 	  to avoid having to dedicate a thread to a connection.
> 
> How does this differ from mmap/AIOwrite in terms of what it actually 
> achieves?

Because you more easily do copy avoidance.  The idea is that it will copy
data out of the buffer cache to the network without any data copies in the
middle, ie. to mbufs.  Trying to implement this using traditional calls is
possible, but can get ugly and involves some tradeoffs.  With a
sendfile(), the memory for the socket buffer goes away and the kernel can
essentially copy data directly from the buffer cache.

Combine that with a file handle cache of frequently accessed files in the
server, and you no longer have to open and close files, and sending the
response is a single syscall that goes from the buffer cache to the
network. 

While you can easily make a wrapper that has the same external view in
user space there is no point because performance sucks.  Also, many
systems have troubles with large write()s so you have to split them up.

> 
> > An efficient poll().
> 
> What's inefficient about the current poll()?

I have no idea; haven't looked.  All I mean is a real poll that doesn't
just hack on top of select but is implemented the logical way for poll to
be done.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.95.980307223608.2799K-100000>