[lkml]   [2001]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
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

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. ]


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:17    [W:0.124 / U:16.836 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site