lkml.org 
[lkml]   [2001]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Is sendfile all that sexy?

On Mon, 15 Jan 2001, Jonathan Thackray wrote:

> It's a very useful system call and makes file serving much more
> scalable, and I'm glad that most Un*xes now have support for it
> (Linux, FreeBSD, HP-UX, AIX, Tru64). The next cool feature to add to
> Linux is sendpath(), which does the open() before the sendfile() all
> combined into one system call.

i believe the right model for a user-space webserver is to cache open file
descriptors, and directly hash URLs to open files. This way you can do
pure sendfile() without any open(). Not that open() is too expensive in
Linux:

m:~/lm/lmbench-2alpha9/bin/i686-linux> ./lat_syscall open
Simple open/close: 7.5756 microseconds

m:~/lm/lmbench-2alpha9/bin/i686-linux> ./lat_syscall stat
Simple stat: 5.4864 microseconds

m:~/lm/lmbench-2alpha9/bin/i686-linux> ./lat_syscall write
Simple write: 0.9614 microseconds

m:~/lm/lmbench-2alpha9/bin/i686-linux> ./lat_syscall read
Simple read: 1.1420 microseconds

m:~/lm/lmbench-2alpha9/bin/i686-linux> ./lat_syscall null
Simple syscall: 0.6349 microseconds

(note that lmbench opens a nontrivial path, it can be cheaper than this.)

nevertheless saving the lookup can be win.

[ TUX uses dentries directly so there is no file opening cost - it's
pretty equivalent to sendpath(), with the difference that TUX can do
security evaluation on the (held) file prior sending it - while sendpath()
is pretty much a shot into the dark. ]

Ingo

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:17    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site